9

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?

4 Answers 4

9

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).

1
  • Using dconf-tool in Ubuntu 18.04 I can't find this key :(
    – Enrico
    Jun 19, 2018 at 21:16
3

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.

1
  • the problem reapeared when I had other things (mouse, webcam) plugged to the monitor--but works fine again since I plugged these to the computer or keyboard (via computer)
    – user11243
    Mar 15, 2011 at 21:13
3

You can change GNOME keyboard layout options in System -> Preferences -> Keyboard.

You can edit key bindings in System -> Preferences -> Keyboard Shortcuts.

These may not have the same flexibility as xmodmap, but should work properly even after screensaver/lock screen.

1
  • 2
    Thanks for the suggestions. I forgot to mention in the question that I use xmodmap mainly to add accented characters to some modifier+letter combination. As far as I can see, this cannot be accomplished with the tools available in the menu. Aug 10, 2010 at 18:57
2

I have custom key bindings stored in an xkb file, which I can load with xkbcomp. I have never experienced any problems with the screensaver resetting this config.

You can then put the xkbcomp command in your .xinitrc file to load the keymap whenever x starts.

1
  • Thanks! This would probably be the way to go if I were starting my keyboard layout edits now. However, I already have some quite extensive modifications in Xmodmap format and don't feel like spending an evening to convert the files... Aug 10, 2010 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.