You are not logged in.

#1 2020-04-05 06:38:17

amiragha
Member
From: US
Registered: 2012-11-20
Posts: 19

[Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

Hello everyone,

I notice my right Alt key is no longer functioning as before (no idea how it changed). I used the `xev` tool and realized it is mapped to level3 shift key. I suppose this is not the intended behavior for the en(US) keymap, right?

Please let me know how can get the layout back to normal/default settings. Also I would appreciate some insight into what could be the cause of this issue!!

thanks

Last edited by amiragha (2020-04-05 07:40:26)

Offline

#2 2020-04-05 07:07:52

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

Please post the outputs of

setxkbmap -print -query
xmodmap -pke

(in code tabs)

Offline

#3 2020-04-05 07:17:18

amiragha
Member
From: US
Registered: 2012-11-20
Posts: 19

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

Ok, seems like it also says this level3 shift in the setxkbmap. Here is the output to

$ setxkbmap -print -query
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+ir:2+de:3+us:4+inet(evdev)+group(shifts_toggle)+level3(ralt_switch)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
rules:      evdev
model:      pc105
layout:     us,ir,de,us
variant:    ,,,
options:    lv3:ralt_switch,grp:shifts_toggle

and the `xmodmap` (only relevant lines)

$ xmodmap -pke | grep 'Shift\|Alt'
keycode  50 = Shift_L ISO_Prev_Group Shift_L ISO_Prev_Group Shift_L ISO_Prev_Group Shift_L ISO_Prev_Group
keycode  62 = Shift_R ISO_Next_Group Shift_R ISO_Next_Group Shift_R ISO_Next_Group Shift_R ISO_Next_Group
keycode  64 = Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L
keycode  92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift NoSymbol ISO_Level3_Shift ISO_Level3_Shift
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift NoSymbol ISO_Level3_Shift ISO_Level3_Shift
keycode 204 = NoSymbol Alt_L NoSymbol Alt_L NoSymbol Alt_L NoSymbol Alt_L

Offline

#4 2020-04-05 07:28:52

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

Well, yes:

options:    lv3:ralt_switch
layout:     us,ir,de,us

Did something went wrong here?
What's the actual idea?
=> Config files?

Offline

#5 2020-04-05 07:37:18

amiragha
Member
From: US
Registered: 2012-11-20
Posts: 19

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

Ok, thanks. I just used

 setxkbmap-option 

  command to change the options and the issue seems to be resolved for now. I guess I only needed to know how this command works! Is this the recommended approach to change these options?

I mark the questions as solved.
Thanks again for your help.

Offline

#6 2020-04-05 07:48:43

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

https://wiki.archlinux.org/index.php/Xo … figuration
If you're the only user of the system, https://wiki.archlinux.org/index.php/Xo … tion_files is far more robust (eg. when the keyboard re-registers from some power saving)

For "setxkbmap -option …" it's important that this only adds options. You'll have to pass an empty string first to clear all options.
Also this is transient.

Some of the bigger DEs also bring their own configuration that will override the settings in the xorg config, so you want to tune those down.

Offline

#7 2020-04-05 19:39:25

amiragha
Member
From: US
Registered: 2012-11-20
Posts: 19

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

So I think my question is kind of back. First of all the config file for xorg keyboard in /etc/X11/xorg.conf.d/00-keyboard.conf doesn't show the level3 shift:

# /etc/X11/xorg.conf.d/00-keyboard.conf 

# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,ir,de"
        Option "XkbVariant" ",,"
EndSection

Any ideas how this option of maping alt_r to level3 shift is forced on my configurations? So that I don't have to change them all the time?
I am also using Gnome but don't see any option regarding this mapping in either setting and tweak tool! The show keyboard layout window also shows level_3 shift instead of alt for the en(us) layout?!!

Offline

#8 2020-04-05 21:35:55

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

Gnomes "region and language" settings: https://wiki.gnome.org/Design/SystemSet … ndLanguage

Offline

#9 2020-04-05 22:51:27

amiragha
Member
From: US
Registered: 2012-11-20
Posts: 19

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

I know where the region and language settings are, but I don't see any option to change the third level shift there. There you can just choose the language and your layout!

In fact, the page you sent actually explicitely say

The Third Level Chooser is not automatically mapped to the Right Alt or AltGr key

I have also looked into possible options in the tweak tool but nothing about  this mapping of alt_r to level3 shift. This made it even more confusing.

Amir

Offline

#10 2020-04-06 06:02:03

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

The link is just a kind of design study, it was mostly meant for the illustrative images.

Since you have a second us layout in the list, I assume that's added by gnome (and possibly just implicitly adds those options)?

In doubt open another thread to inquire this specifically (with a more infomative subject) - I've no first-hand experience w/ gnome.

Offline

#11 2020-11-12 01:43:40

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout

tl;dr

There are 3 possible solutions:

  1. navigate to Gnome's Settings > Keyboard Shortcuts > Alternate Characters Key > Choose different key

  2. change the 'lv3:ralt_switch' setting to an alternate lv3 option (ie. 'lv3:menu_switch' sets this to the menu key instead)

  3. leave 'lv3:ralt_switch' set and also enable 'lv3:ralt_alt' to prevent Right Alt from ever choosing the 3rd level

I was trying to figure out why my right Alt key had been hijacked by ISO_Level3_Shift as well.  The Gnome Tweak Tool's Additional Layout Options didn't indicate this should be set that way, nor did I see any options set in the output of localectl, so I was rather stumped until I stumbled across the solution today.

I just so happened to be changing a keyboard shortcut in Gnome and found the Alternate Characters Key setting in the Keyboard Shortcuts settings section. There I found that mine was set to Right Alt!  I changed mine to the Menu key to test (my Thinkpad X1 Carbon doesn't have an actual Menu key) and xev is now indicating that I have a right Alt key once again.

Further investigation lead me to discover that this is actually controlled by the 'lv3:ralt_switch' xkb option, despite this not being reflected in Tweak Tool. It can be seen if the following gsettings key is queried...

$ gsettings get org.gnome.desktop.input-sources xkb-options

To test the various lv3 options without making the change permanent, use setxkbmap...

$ setxkbmap -option 'lv3:ralt_alt'

Personally, I went with setting the 'lv3:ralt_alt' option because there seem to be some conditions (that I haven't nailed down) where it gets reverted back to using Right Alt again.  I did so globally using localectl...

$ localectl set-x11-keymap us '' '' 'lv3:ralt_alt'

To see all the lv3 options available, localectl may be used as well...

$ localectl list-x11-keymap-options | grep lv3

If you want to know what each of these settings actually does, the only place I've found descriptions of these various options is in the base.lst file, which is owned by the xkeyboard-config package...

/usr/share/X11/xkb/rules/base.lst

Hopefully this might save someone else a bit of time and effort in trying to figure out why Gnome hates Right Alt so much.


EDIT: It turns out that Gnome and gdm actually ignore the settings written to /etc/X11/xorg.conf.d/00-keyboard.conf by localectl. So rather than setting it globally, I had to set this for just my own user with gsettings in order to get these settings to take (I've included more than just the one xkb option setting in the example below to show the syntax if wanting to set multiple options)...

$ gsettings set org.gnome.desktop.input-sources xkb-options "['lv3:ralt_atl', 'compose:prsc', 'terminate:ctrl_alt_bksp']"

Also, I had hit a scenario where the reestablished Right Alt key correctly reports being a Alt_R key press, but it isn't actually functioning as an Alt key. Turned out that it was because it wasn't also defined in the list of modifier keys (ie. shown by xmodmap -pm output). But a subsequent reboot seems to have fixed it and I can't seem to even get it back to that wonky state. So probably nothing to worry about, but just fair warning.

Last edited by WonderWoofy (2020-11-12 17:37:09)

Offline

Board footer

Powered by FluxBB