GNOME Bugzilla – Bug 660000
custom ~/.xmodmap is not loaded unless keyboard preferences have some changes
Last modified: 2013-01-30 15:05:08 UTC
The custom ~/.xmodmap is only loaded if some (unrelated) settings have been changed in gnome-keyboard-properties. Steps to reproduce: 1. create ~/.xmodmap, customize some keys, and load it with xmodmap 2. open gnome-keyboard-properties, Layouts tab, choose "Reset to Defaults" 3. re-plug your keyboard (assuming it's an USB keyboard) or restart X11 Result: the modifications in ~/.xmodmap are no longer in effect (but they should be) 4. open gnome-keyboard-properties, Layouts tab, Options, make any change (I enabled "Both shift keys enable CapsLock") 5. re-plug your keyboard (or restart X11) Result: the modifications in ~/.xmodmap are loaded as expected. I discovered this problem during hotplugging my USB keyboard (because it is attached to a USB hub powered by my monitor). Took me a while to figure out what was really going on (why did I have to press this "reset to defaults button" :-), so I report it. I have also tested this with two keyboards attached, a PS2 Keyboard and a USB keyboard. In this case, the PS2 Keyboard will keep its custom xmodmap settings (it is not hotplugged), while the USB keyboard loses them as described above.
In libgnomekbd, libgnomekbd/gkbd-keyboard-config.c, line 583: if (rv) { Could you please try replacing it with if (TRUE) { If it works for you, I will commit the change (getting rid of that "if" altogether).
I can build libgnomekbd from git (on debian testing), but how do I use it? I have added it to my LD_LIBRARY_PATH and I start gnome-settings-daemon manually it doesn't seem to load any shared object resembling libgnomekbd. Do I need to restart or rebuild something else?
gnome-settings-daemon should load keyboard plugin (/usr/lib/gnome-settings-daemon-3.0/libkeyboard.so) which should load libgnomekbd.
Thanks, maybe the bigger problem was that I was still using Gnome 2. Enjoying Gnome 3 now. The problem still exists. Your suggested change does not fix it. I have added a g_printerr() before the "if (rv)" and I can see its output in my .xseesion-errors when it loads my .xmodmap. I cannot see the print any more after I hit the "reset to defaults" button and replug my keyboard.
Could you please try the latest libgnomekbd 3.5.1 from git and gnome-settings-daemon from git as well. I hope I've fixed that issue - .xmodmap is loaded even if XKB config is not changed, nominally.
Closing it. Feel free to reopen if it is still not ok.
I still experience this problem on GNOME 3.6.2. I upgraded from FC17 -> FC18 and my ~/.[Xx]modmap file is now ignored. Not only this, but on resume my settings set by manually running `xmodmap` utility is reset. I need to run `xmodmap ~/.xmodmap` manually everytime I boot and everytime I resume after suspend. I'm re-openning the bug for this reason.
I've realized another issue. It's not only when I resume that I need to run `xmodmap` manually in order to fix my keys, but also when I use Caps + Shift for layout change, my keyboard mapping is reset. So issue is there but in reverse case. In the original case it was a layout change was needed to have .xmodmap file read, but for my case layout change makes .xmodmap changes ignored. So it's worse than I first thought. I used F12 often and on my thinkpad default key mapping to physical key is not function key but a multimedia key, I'm swapping the keys using .xmodmap. (There's an option in BIOS to use legacy function keys for them, but that is reverted on suspend probably due to a BIOS bug, so Xmodmap option is ok). It was working without any problem on my FC17 install btw. FC18 update broke it.