Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read
Q&A

Set compose key to Shift + AltGr

+2
−0

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.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+2
−0

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.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us! Donate