I use xmodmap to alter my keyboard layout during session startup.
However, each time the GNOME screensaver/lock screen is activated, it
resets the keyboard to its default layout, and I have to run xmodmap
again to get my keybindings back.
I understand that resetting the keyboard layout is the right thing to
do before presenting a password prompt, but Is there a way to stop the
GNOME screensaver from doing it? Or a way to tell GNOME to use a
custom keyboard layout all the time?
Searching with gconf-tool, I found the setting /desktop/gnome/peripherals/keyboard/general/update_handlers, which apparently is a list of Xmodmap files to be (re)loaded each time the keyboard status is reset.
Settiing this to .Xmodmap made the thing work for me (after logging out and back in).
At log in the .Xmodmap (set up as user or globally) would read properly. However, when the monitor goes to sleep, and I log back in, it would be reset and keys would work as before .Xmodmap was loaded. No setting worked around until at some point I realized that my keyboard is plugged in to the monitor and thus all sittings are lost when the monitor goes to sleep or is turned off. What helped was to plug in the keyboard directly to the computer tower. Now the initial reading of .Xmodmap right after logging in is maintained independently of the monitor being on or off.