After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 660000 - custom ~/.xmodmap is not loaded unless keyboard preferences have some changes
custom ~/.xmodmap is not loaded unless keyboard preferences have some changes
Status: RESOLVED FIXED
Product: libgnomekbd
Classification: Core
Component: Config
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: libgnomekbd maintainers
Sergey V. Udaltsov
Depends on:
Blocks:
 
 
Reported: 2011-09-24 10:45 UTC by Martin Renold
Modified: 2013-01-30 15:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Martin Renold 2011-09-24 10:45:30 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.
Comment 1 Sergey V. Udaltsov 2011-10-01 20:24:11 UTC
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).
Comment 2 Martin Renold 2011-10-02 09:46:57 UTC
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?
Comment 3 Sergey V. Udaltsov 2011-10-02 17:40:53 UTC
gnome-settings-daemon should load keyboard plugin (/usr/lib/gnome-settings-daemon-3.0/libkeyboard.so) which should load libgnomekbd.
Comment 4 Martin Renold 2011-10-15 16:41:40 UTC
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.
Comment 5 Sergey V. Udaltsov 2012-04-01 00:42:16 UTC
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.
Comment 6 Sergey V. Udaltsov 2012-04-01 12:37:44 UTC
Closing it. Feel free to reopen if it is still not ok.
Comment 7 Baris Cicek 2013-01-29 19:04:55 UTC
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.
Comment 8 Baris Cicek 2013-01-30 15:05:08 UTC
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.