Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xmodmap & multiple layouts

I currently use two keyboard layouts with an xorg.conf like

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

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

xmodmap -e "keycode 108 = Menu"

but only modifies the key on the first layout. How can I modify it on all layouts? Could something be done using advanced XkbOption or XkbLayout parameters?

like image 968
XZS Avatar asked Mar 07 '12 16:03

XZS


People also ask

What is Xmodmap?

Description. The xmodmap command edits and displays the keyboard modifier map and keymap table that client applications use to convert event keycodes into key symbols. It is usually run from the session startup script to configure the keyboard according to the personal tastes of the user.

How do I remap keys with Xmodmap?

How to remap keys with xmodmap step by step instructions. Start by making a copy of the current mappings and storing the file in your $HOME directory. Now, using nano or your favorite terminal or GUI file editor, open this file to make your desired changes. Exit the file and save changes when done.

What is KeySym?

A KeySym is an encoding of a symbol on the cap of a key. The set of defined KeySyms includes the ISO Latin character sets (1-4), Katakana, Arabic, Cyrillic, Greek, Technical, Special, Publishing, APL, Hebrew, Thai, Korean and a miscellany of keys found on keyboards (Return, Help, Tab, and so on).

What is hyper key?

A Hyper Key is a magical key which automatically presses all the standard modifiers (ctrl+shift+cmd+opt). Why would you need that? Because on macOS many of the easy to reach shortcut combinations are already used by the system or by some app.


1 Answers

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* as you like and attach shortcuts to scripts ~/key-de and ~/key-us.

like image 162
abo-abo Avatar answered Sep 29 '22 22:09

abo-abo