Ubuntu – Custom keyboard shortcuts are reset. How to make them set permanently

12.0412.10shortcut-keysunity

I'm having a problem with both Ubuntu 12.04 and 12.10 with custom keyboard shorcuts. They are reset after a while (I can't find a pattern but it seems to be when a massive upgrade happens). It happend to me a couple of days ago, when 12.10 got about 27 updates.
I've searched launchapd and askubuntu, and found no question similar.
My shortucts are not lost on reboot, I still can't find a pattern to identify the problem as I said.
I tried also not using Control Center app, but gnome's dconf-editor, but same result as I found on some blog post.
My question is, how can I save my custom shorcuts to restore them when this happens?
Can somebody help me compose a bug for launchpad, like what package could be causing this, so I can fill a bug report.
Thanks in advance.

Best Answer

Thanks to Graham's links, it seems this was fixed for 13.04 but not "backported" to 12.10.

Update Amazingly.. this doesn't appear to be fixed in 13.04 release! :( I still had to use solution below.

Until then here's something I've pieced together from the comments on launchpad, it works for me on Ubuntu 12.10.

/etc/rc.local didn't work for me, so I created ~/.config/autostart/key_settings.desktop :

[Desktop Entry]
Type=Application
Exec=sh -c 'sleep 1; exec ~/.config/autostart/key_settings.sh'
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Load My Custom Shortcuts

Then the actual script ~/.config/autostart/key_settings.sh:

#!/bin/sh -e
#
#dconf write /org/gnome/desktop/wm/keybindings/minimize "['<Super>h']"
#dconf write /org/gnome/desktop/wm/keybindings/close "['<Super>q']"

gsettings set org.gnome.desktop.wm.keybindings minimize "['<Super>h']"
gsettings set org.gnome.desktop.wm.keybindings close "['<Super>q']"

Commented out the dconf method for reference, though gsettings works for me.

To find the keycodes, you can simply use Keyboard Shortcuts window open next to Terminal, then use the "get" command:

gsettings get org.gnome.desktop.wm.keybindings minimize

PS: this was meant more to elaborate on a practical fix suggested by Graham's links.