Skip to content
Dave Davenport edited this page Nov 14, 2019 · 10 revisions

Apart from dmenu mode, rofi can be told to call a custom script.

Basic flow

If you start rofi -modi yourscript:yourscript.sh -show yourscript, this happens:

  1. Rofi calls yourscript.sh without parameters.
  2. Your script needs to write its choices to stdout, separated by line breaks (\n).
  3. Rofi shows these entries and allows the user to choose one.
  4. Your script is called again with the chosen entry as its parameter.

Pass extra properties in script mode

To further improve script mode, support for passing properties exists. You can now set the prompt, a message or use markup and active/urgent colors from the script itself.

E.g. to set the prompt from a bash mode script:

echo -en "\x00prompt\x1ftesting\n"

Or to mark the first 4 rows urgent and add a message:

echo -en "\x00urgent\x1f0-3\n" echo -en "\0message\x1fSpecial bold message\n"

The urgent and active syntax is identical to the dmenu command-line argument.

The following commands are supported:

  • message
    
  • prompt
    
  • markup-rows
    
  • urgent
    
  • active
    

Advanced configuration

More parameters

You can already let rofi call your script with parameters, by starting it like this: `rofi -modi yourscript:"yourscript.sh first_parameter second_parameter". They will also be included in the last call with the user's choice.

Customization

To enable pango markup, have your script print \x00markup-rows\x1ftrue\n to stdout before it writes the choices. Similarly, you can change the prompt and the message, as well as the "urgent" and "active" flag.

However, custom keybindings and multi-selection are not possible as a mode.

Clone this wiki locally