Freitag, 1. Juni 2012

Gnome 3.4 in Ubuntu 12.04 and keyboard shortcuts

When I upgraded to Ubuntu 12.04 the first thing I did was install Gnome 3 and scrap Unity. However at the end of my setup efforts when it came to setting up my custom keyboard shortcuts both Ubuntu and Gnome threw stones in my way. In the end I was able to configure all of them, and this is how...

Using the Win-key

I tend to use the "Super"/"Meta"/"Windows" key in many of my custom shortcuts because there are almost no default shortcuts on linux in which this key is involved. However in Gnome 3, by default the Windows-key is bound to "Show the Activities Overview" which makes it unusable in shortcuts. To disable this behaviour open Settings->Keyboard Layout->Options... and change the "Alt/Win key behaviour" to "Meta is mapped to Left Win".

Some people suggest it should be "Meta is mapped to Win Keys" but on my german keyboard this screws up the "Alt Gr"-key.

Gnome 3 Shortcuts

So when you press the Meta-key now, it does nothing. Now normally you would setup keyboard shortcuts in Settings->Keyboard->Shortcuts.

However changing shortcuts here has no effect. It seems this is because in Gnome 3.4 the shortcuts are now managed differently and not all components reflect those changes yet. The new backend used to save all shortcuts is now "dconf". The "dconf-editor" is used to edit this config directly.

# apt-get install dconf-tools

Then open the dconf-editor and look for the corresponding keybinding entries. There are several:
  • org/gnome/settings-daemon/plugins/media-keys
  • org/gnome/mutter/keybindings
  • org/gnome/desktop/wm/keybindings
  • org/gnome/shell/keybindings
There may be more locations I'm not aware of, but these are the ones I searched. Find the keybinding you want to modify and edit the entry manually.

You can use either "<Super>", "<Meta>" or "<Mod4>" to denote the "Meta"-key. When you are done editing changes take effect immediately.

Custom Shortcuts

Configuring custom shortcuts in Gnome's keyboard menu (Settings->Keyboard->Shortcuts) actually works. You can setup custom shortcuts here.

Only when you want to use the "Meta"-key in you key-bindings it does not work. Normally these key-bindings should also be reflected in dconf. They should be located at "" but they are not because Ubuntu patched gnome-settings to use the older "gconf" instead (I suppose this is also the reason for the issue with the Gnome 3 shortcuts not working). So to workaround that you need to use the "gconf-editor".

# apt-get install gconf-editor

In the gconf-editor navigate to /desktop/gnome/keybindings/ and select the custom entry you want to modify.

Edit the value of the "binding"-property and replace the "<Super>" with "<Mod4>" because no other alias will work with gconf. When you're finished editing the changed also take effect immediately. Now the shortcut should work.

I think both Ubuntu and Gnome did their part in screwing this up, but with these workarounds I hope you can enjoy them both anyways. If you're interested in the progress on these bugs:
I hope they fix them soon. Until then, enjoy with these workarounds.