Issue
I have set a mapping to change the keyboard layout using this command setxkbmap -layout us,pl,ru,ua -option grp:alt_space_toggle
. But it works in unexpected ways. On the first Alt+Space press, the keyboard layout is changed from us
to pl
. On the following key presses, nothing happens. I have tried to catch a hotkey overlay using xdotool key XF86LogGrabInfo
. It appears to me that no application reacts to this key press. What can cause the problem?
Linux slado122 5.13.12-arch1-1 #1 SMP PREEMPT Wed, 18 Aug 2021 20:49:03 +0000 x86_64 GNU/Linux
X.Org X Server 1.20.13
X Protocol Version 11, Revision 0
Build Operating System: Linux Archlinux
Current Operating System: Linux slado122 5.13.12-arch1-1 #1 SMP PREEMPT Wed, 18 Aug 2021 20:49:03 +0000 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=a3a15c1b-a762-4080-b265-fa132c60fdde rw loglevel=3 quiet
Build Date: 04 August 2021 08:13:54AM
Current version of pixman: 0.40.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Edit: Both Right and Left Alts don’t work. Also, additional info: I can change from us
to pl
with the shortcut, then manually change to ru
with xkb-switch -n
, then change from ru
to ua
with the shortcut, and then it doesn’t work again. To summarize, the mapping doesn’t work for changing language groups.
Solution
This looks like a cargo-cult copy-paste bug in the Polish xkb layout.
If you remove the first line containing key <SPCE>
from /usr/share/X11/xkb/symbols/pl
it will work as expected.
You can test my suggestion non-destructively by running the following commands as root:
sed /SPCE/d /usr/share/X11/xkb/symbols/pl >/tmp/pl &&
mount -B /tmp/pl /usr/share/X11/xkb/symbols/pl
then repeating your setxkbmap
command as the regular user. With umount /usr/share/X11/xkb/symbols/pl
you get back the original file.
NB: the Alt-Space toggle is not expected work with the right Alt key while in the Polish layout, because the right Alt key is mapped to AltGr
(aka ISO_Level3_Shift
) there.
I suggest using a less conflicting key combo to switch layouts (like both Controls pressed at once, as with -option grp:ctrls_toggle
.
Answered By – ktzap
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0