Set compose key to Shift + AltGr
I have upgraded Xubuntu from 20.04 to 22.04 and my compose key, which defaulted to Shift + AltGr, was disabled. It is no longer available in the keyboard settings GUI either.
How can I set the compose key to Shift + AltGr again?
Adapted from Ask Ubuntu: Upgrading from Xubuntu 20.04 to 22.04 has disabled my compose key, which I now can't set to its old default.
1 answer
You can find a list of options in man xkeyboard-config
.
Under the section "key to choose the 3rd level" is the one you are after:
lv3:ralt_switch_multikey Right Alt; Shift+Right Alt as Compose
To enable it, use
setxkbmap -option lv3:ralt_switch_multikey
You should also pass other options you already use to -layout
or they will be reverted.
To make it permanent, add it to the comma separated XKBOPTIONS variable
in /etc/default/keyboard
, e.g.:
XKBMODEL="pc105"
XKBLAYOUT="en"
XKBVARIANT=""
XKBOPTIONS="lv3:ralt_switch_multikey"
BACKSPACE="guess"
That option is defined in /usr/share/X11/xkb/symbols/level3 as
// The right Alt key (while pressed) chooses the third shift level,
// and Compose is mapped to its second level.
partial modifier_keys
xkb_symbols "ralt_switch_multikey" {
key <RALT> {
type[Group1]="TWO_LEVEL",
symbols[Group1] = [ ISO_Level3_Shift, Multi_key ]
};
include "level3(modifier_mapping)"
};
In general, if the desired combination weren't available, you could create your own map. E.g., to make the menu key* have that behavior,
==> ~/.config/xkb/symbols/mymap <==
partial alphanumeric_keys modifier_keys
xkb_symbols "mymap" {
key <MENU> {
type="TWO_LEVEL",
symbols[Group1] = [ ISO_Level3_Shift, Multi_key ]
};
};
Then create this one from setxkbmap -print
and append your custom option
to xkb_symbols
:
==> ~/.config/xkb/main <==
xkb_keymap {
xkb_keycodes{include "evdev+aliases(qwerty)"};
xkb_types {include "complete"};
xkb_compat {include "complete"};
xkb_symbols {include "pc+en+inet(evdev)+mymap(mymap)"};
xkb_geometry{include "pc(pc105)"};
};
Finally, run
xkbcomp -I"$HOME/.config/xkb" "$HOME/.config/xkb/main" "$DISPLAY"
at every X session start to put load that custom key map.
*xkbcomp "$DISPLAY" -
outputs your full key map; useful to find a key name.
0 comment threads