Saturday, December 4, 2010

Run shell script through keybinding

Press Ctrl+Alt+Insert to start an Xterm running the 'top' command, and press Ctrl+Alt+Delete to kill it:
gconftool-2 -t str --set /desktop/gnome/keybindings/custom1/name "Start top command"
gconftool-2 -t str --set /desktop/gnome/keybindings/custom1/binding "Insert"
gconftool-2 -t str --set /desktop/gnome/keybindings/custom1/action "xterm -e /usr/bin/top"

gconftool-2 -t str --set /desktop/gnome/keybindings/custom2/name "Stop top command"
gconftool-2 -t str --set /desktop/gnome/keybindings/custom2/binding "Delete"
gconftool-2 -t str --set /desktop/gnome/keybindings/custom2/action "xterm -e kill -9 $(ps aux grep top grep -v grep)"

No comments: