Custom Keybindings in elementary OS

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

  1. wledoux

    Doesnt work on my setup (elementary luna beta2)
    Do you need to restart or anything for the shortcut to work ?

  2. wledoux

    Well, after rebooting, it works fine

  3. I believe this is a real great weblog article.Much thanks again. Awesome.

  4. Nep

    Will this work with a scrollwheel?
    I want to be able to set volume up/down with Super+scroll up/down

    • heathbar

      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: 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>