GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
* Sign Up! *

Support
Customer Portal
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
rofi-actions(5) File Formats Manual rofi-actions(5)

rofi-actions - Custom commands following interaction with rofi menus

rofi allows to set custom commands or scripts to be executed when some actions are performed in the menu, such as changing selection, accepting an entry or canceling.

This makes it possible for example to play sound effects or read aloud menu entries on selection.

Following is the list of rofi flags for specifying custom commands or scripts to execute on supported actions:

Command or script to run when the current selection changes. Selected text is forwarded to the command replacing the pattern {entry}.
Command or script to run when a menu entry is accepted. Accepted text is forwarded to the command replacing the pattern {entry}.
Command or script to run when the menu mode (e.g. drun,window,ssh...) is changed.
Command or script to run when the menu is canceled.
Command or script to run when an error menu is shown (e.g. rofi -e "error message"). Error text is forwarded to the command replacing the pattern {error}.
Command or script to run when a screenshot of rofi is taken. Screenshot path is forwarded to the command replacing the pattern {path}.

Rofi command line:

rofi -on-selection-changed "/path/to/select.sh {entry}" \

-on-entry-accepted "/path/to/accept.sh {entry}" \
-on-menu-canceled "/path/to/exit.sh" \
-on-mode-changed "/path/to/change.sh" \
-on-menu-error "/path/to/error.sh {error}" \
-on-screenshot-taken "/path/to/camera.sh {path}" \
-show drun

Rofi config file:

configuration {

on-selection-changed: "/path/to/select.sh {entry}";
on-entry-accepted: "/path/to/accept.sh {entry}";
on-menu-canceled: "/path/to/exit.sh";
on-mode-changed: "/path/to/change.sh";
on-menu-error: "/path/to/error.sh {error}";
on-screenshot-taken: "/path/to/camera.sh {path}"; }

Here’s an example bash script that plays a sound effect using aplay when the current selection is changed:

#!/bin/bash
coproc aplay -q $HOME/Music/selecting_an_item.wav
    

The use of coproc for playing sounds is suggested, otherwise the rofi process will wait for sounds to end playback before exiting.

Here’s an example bash script that reads aloud currently selected entries using espeak:

#!/bin/bash
killall espeak
echo "selected: $@" | espeak
    
rofi

Search for    or go to Top of page |  Section 5 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.