Score:4

Remap right Windows key to Alt Gr?

so flag

Image of keyboard

EDIT: This is Ubuntu 23.04 x64 in the default Ubuntu flavor.

I have upgraded my ancient Model M keyboard to a modern one where Windows keys have been added. Being Danish we use the Alt-Gr key a lot which has been shifted one key to the right and a Windows key is now where my muscle memory goes.

I would like to remap the right Windows key to Alt-Gr (and leave the left Windows key as is. The output from xev when pressing and releasing the keys is:

KeyPress event, serial 38, synthetic NO, window 0x3800001,
    root 0x49d, subw 0x0, time 18696093, (125,74), root:(2722,175),
    state 0x10, keycode 134 (keysym 0xffec, Super_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x3800001,
    root 0x49d, subw 0x0, time 18696725, (125,74), root:(2722,175),
    state 0x50, keycode 134 (keysym 0xffec, Super_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x3800001,
    root 0x49d, subw 0x0, time 18697421, (125,74), root:(2722,175),
    state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x3800001,
    root 0x49d, subw 0x0, time 18698721, (125,74), root:(2722,175),
    state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

What is the best way to do this remapping? Can the Ubuntu tools help edo this, or do I need to do some low level X11 magic?

24601 avatar
in flag
please [edit] your question with details of the version/Distro of Ubuntu in use.
vanadium avatar
cn flag
Some low level X11 mapping may not work if you run Wayland (the default)
Score:5
uz flag

That's what the Alternate Characters Key control in Settings -> Keyboard is for.

Disable the Use layout default switch and select Right Super.

user18619318 avatar
so flag
This made my right Windows key get the Alt-GR functionality (but the Alt-Gr key lost it). This is not very well explained in the Settings program, so thanks for pointing it out.
Gunnar Hjalmarsson avatar
uz flag
@user18619318: Any idea how it could be explained better?
user18619318 avatar
so flag
Explicitly mentioning that this is the Alt-Gr behavior would have been helpful.
Gunnar Hjalmarsson avatar
uz flag
@user18619318: Note that the key is named "Right Alt" on some keyboards While the <AltGr> /<Right Alt> key is used by default as the key for accessing 3rd and 4th level symbols, "the AltGr behavior" wouldn't describe the control very accurately.
user18619318 avatar
so flag
I would suggest that mentioning in passing the information you just stated there, would help others like me to actually understand what the help text is helping with.
Gunnar Hjalmarsson avatar
uz flag
@user18619318: Currently it says: "The alternate characters key can be used to enter additional characters. These are sometimes printed as a third-option on your keyboard." Would you like to see an elaboration of that info?
user18619318 avatar
so flag
Yes. "third-option" only makes sense if you know what it is already. "These are sometimes printed as a third-option on your keyboard, frequently Alt-Gr." would probably be sufficient.
Gunnar Hjalmarsson avatar
uz flag
@user18619318: I see the point, and I'll make a mental note about it for now. It's a bit complex, because that section is from GNOME, but Ubuntu applies a couple of patches which need to be taken into consideration.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.