Changing default shortcuts in gnomePosted: January 31, 2009
Another of those thing I usually forget: changing default shortcut actions in gnome. In this case, I’m using MOC as my music player (see apt-get install new computer II and while it’s great it won’t integrate nicely with gnome. Fortunately (as most GNU/Linux applications do) it can be commanded via CLI so it isn’t hard to change this.
Now, gnome keyboard shortcuts already have defined actions, so how can we change them to invoke a custom command? Easy enough:
- Open gconf-editor
- Go to apps > metacity > keybinding_commands
- Set a command from the list. In my case I’m going to set command_1 to “mocp -S”, command_2 to “mocp -f” and command_3 to “mocp -r”
- Go to apps > metacity > global_keybinding
- Set the corresponding run_command_* to the keyboard shortcut. For me that’s 0xA2 for run_command_1, 0xE9 for run_command_2 and 0xEA for run_command_3; beware it changes between keyboards.
- If you use gconf-editor for a key binding don’t use it again System > Preferences > Key bindings
- For hex value keybindings (like the ones I used on the example) use uppercase
- If it’s not working and you can’t figure out why try with an already working command and a simple keybinding (e.g. gnome-screenshot and <Ctrl>p) then change each one in turn, see where it breaks. Divide and conquer!!