3

I use this command: setxkbmap -option "lv3:caps_switch" to customize my keyboard shortcuts (home, end, left and right arrows).

Configuration resides in /usr/share/X11/xkb/symbols/us file. Everything works fine, except when I switch keyboard layout, those mappings made by setxkbmap, stop working and do not work again even if I switch back to US layout. I have to manually re-run setxkbmap -option "lv3:caps_switch" to make my mappings work again.

Is there a way to fix this? My Ubuntu version is 14.04

user.dz
  • 48,105

1 Answers1

2

AFAIK with Ubuntu 13.10, They have changed the Unity/Gnome layout managing way. So it does support multiple input engines and moved the control of layout change shortcut to higher level (window manager/settings daemon).

setxkbmap works with the lower XKB level, settings daemon does not query for changes in the lower level. It just applies directly the settings stored in its database.

There two option which may help you getting that:

  • Store XKB setting (recommended)

    gsettings set org.gnome.desktop.input-sources xkb-options "['lv3:caps_switch']"
    

    Reference: How can I enable Ctrl+Alt+Backspace?

  • Add level 3 setup directly to us layout, as below:

        ...
        key <AB09> {        [    period,    greater         ]       };
        key <AB10> {        [     slash,    question        ]       };
    
        key <BKSL> {        [ backslash,         bar        ]       };
    
        include "level3(caps_switch)"
    };
    

    Then run sudo dpkg-reconfigure xkb-data, switch to another layout then back.

user.dz
  • 48,105
  • Thank you very much, first option worked fine for me. Second one with include "level3(caps_switch)" didn't work for some reason, even after reboot. – mechatroner Jun 08 '15 at 22:26
  • @mechatroner, updated answer I forget to mention it. btw, I'm using US English (international AltGr dead keys), basically for me i just replaced include "level3(ralt_switch)" with include "level3(caps_switch)" – user.dz Jun 09 '15 at 07:58