The keyboard-settings pane in Ubuntu allows custom keyboard combinations to launch applications or scripts. This feature is currently missing from elementary OS’s keyboard plug. However, with a little command line foo we can setup the keybindings without the GUI.
First we need to install gconf2. It may be installed already, but in case it’s not:
sudo apt-get install gconf2
Next we use gconf tool to query which keybindings are already out there:
gconftool-2 --all-dirs "/desktop/gnome/keybindings"
On my machine, this returns 1 entry: /desktop/gnome/keybindings/custom0 We can dig deeper by executing:
gconftool-2 --all-entries "/desktop/gnome/keybindings/custom0"
name = Launch Terminal
action = x-terminal-emulator
binding = <Control><Alt>t
We can see that by default there is only 1 keybinding that launches a terminal. Now we can create our own with the following commands:
gconftool-2 --set "/desktop/gnome/keybindings/custom1/name" --type string "Launch Switchboard" gconftool-2 --set "/desktop/gnome/keybindings/custom1/action" --type string "switchboard" gconftool-2 --set "/desktop/gnome/keybindings/custom1/binding" --type string "<Control><Alt><Shift>s"
Each keybinding needs it’s own folder. In this case, I used “custom1” since “custom0” was already in use. The rest should be pretty self-explanatory: give it a name, an action (command or script to run) and the keybinding you’d like to use.
5 thoughts on “Custom Keybindings in elementary OS”
Doesnt work on my setup (elementary luna beta2)
Do you need to restart or anything for the shortcut to work ?
Well, after rebooting, it works fine
I believe this is a real great weblog article.Much thanks again. Awesome.
Will this work with a scrollwheel?
I want to be able to set volume up/down with Super+scroll up/down
You could try using <Button4> or <Button5> for mouse scroll events, but I doubt that will work.
Instead, you may have to use something like xbindkeys. I did a post on xbindkeys here: http://www.heath-bar.com/blog/?p=523 In that article, I bound the
+ mouse scroll to type + Plus/Minus, but you could change it to enter the Volume Up/Down keys instead.