Skip to content

Simple shell script that reads a json file and display the items as rofi menu entries.

Notifications You must be signed in to change notification settings

luiscrjunior/rofi-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

rofi-json

Simple shell script that reads a json file and display the items as rofi menu entries.

Supports icon.

Screen1

Screen1

Usage

  1. Make sure you have jq (Command-line JSON processor) utility installed (arch package).

  2. Copy rofi-json.sh from this repo (or git clone and link) to your rofi's configuration folder (i.e. ~/.config/rofi) and make it executable (chmod +x rofi-json.sh).

  3. Create your JSON file (you can check examples folder).

  4. Launch rofi with -modi <NAME_OF_THE_MODE>:<PATH_OF_SCRIPT>/rofi-json.sh <JSON_FILE>:

rofi -modi "My Apps":"~/.config/rofi/rofi-json.sh my_apps.json" -show "My Apps"

<JSON_FILE>: you can specify an absolute path (or ~), or just leave the json file name if it is located in the same directory as the rofi-json.sh file.

JSON Example

[
  {
    "name": "Google Chrome",
    "command": "google-chrome-stable",
    "icon": "google-chrome"
  },
  {
    "name": "gnome-disks"
  },
  {
    "name": "pavucontrol"
  },
  {
    "name": "journalctl -xeaf",
    "command": "urxvt -e bash -c 'journalctl -xeaf'"
  }
]

command key is optional. If not specified, the script will run name's value.

icon key is optional (Default: system-run).

Multiple JSON files

You can run rofi-json script with different json's files and create multiple modi's:

rofi \
    -modi config:"~/.config/rofi/rofi-json.sh config.json","My Apps":"~/.config/rofi/rofi-json.sh my_apps.json" \
    -show "My Apps"

Credits

Adapted from Myrmidon

About

Simple shell script that reads a json file and display the items as rofi menu entries.

Topics

Resources

Stars

Watchers

Forks

Languages