Xmodmap and multiple layouts

I am currently using two keyboard layouts with xorg.conf as

Section "InputClass"
  Identifier      "Keyboard Defaults"
  MatchIsKeyboard "yes"
  Option          "XkbLayout" "us, de"
  Option          "XkbOptions" "grp:caps_toggle"


Now I want to map AltGr to use it as a context menu key. This can be done with

xmodmap -e "keycode 108 = Menu"


but only changes the key on the first layout. How can I change it across all layouts? Could something be done using XkbOption or XkbLayout advanced options?


source to share

1 answer

echo -e "setxkbmap de\nxmodmap ~/.Xmodmap.DE" > ~/key-de && chmod +x ~/key-de
echo -e "setxkbmap us\nxmodmap ~/.Xmodmap.US" > ~/key-us && chmod +x ~/key-us
xmodmap -pke > ~/.Xmodmap.DE
xmodmap -pke > ~/.Xmodmap.US


Now just edit ~ / .Xmodmap * however you like and attach shortcuts to the ~ / key-de and ~ / key-us scripts.



All Articles