Ubuntu – How to stop `gnome-screensaver` from resetting the keyboard to its default layout

10.04gnomekeyboard-layout

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?

Best Answer

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.