Ubuntu – setxkbmap resets in ubuntu 13.10

13.10keyboard

Changes using setxkbmap reset after a minute or two in Ubuntu 13.10. I've been using setxkbmap to modify my keyboard settings for years using Ubuntu, and after the upgrade to 13.10, the changes don't hold for longer than a few minutes.

This is NOT a duplicate. I'm asking specifically why changes made using setxkbmap are reset after a minute or two in Ubuntu 13.10. I'm not asking how to switch keys using other programs like xmodmap, xbindkeys, etc.

Best Answer

Gnome

Gnome preserve xkb options.

  1. Use dconf-editor → Follow path /org/gnome/desktop/input-sources

  2. Put layouts needed in sources, example:

    [('xkb','us'),('xkb','ara')]
    
  3. Add setxkbmap options to xkb-options, example:

    ['grp:rshift_toggle', 'grp:rctrl_switch']
    

    enter image description here

Unity & Gnome

xkb setting seems to be reset by Unity/Gnome settings daemon (periodically or when clicked to change layout) or when layout switch shortcuts used.

The above the method may not work. So this should disable completely the settings daemon layout control capability. Tested on Ubuntu Unity 15.10 .

  1. Rename the keyboard plugin of settings daemon to disable it.

    sudo mv /usr/lib/unity-settings-daemon-1.0/libkeyboard.so /usr/lib/unity-settings-daemon-1.0/libkeyboard.so.disabled
    
  2. Restart the settings daemon

    restart unity-settings-daemon
    

Note:

  • Ubuntu <= 13.10, Gnome & Unity uses same daemon (gnome-settings-daemon).
  • Ubuntu >=14.10, Gnome has gnome-settings-daemon & Unity has unity-settings-daemon
Related Question