You are not logged in.
Hi,
tl;dr
How can I disable RAlt as a temporary keyboard layout switch?
Details:
I'm trying to set up a custom keyboard layout with extended characters, that I want to type using RightAlt+key.
I use two such layouts, one for Russian (where I use RAlt+key to type Belarusian letters), and one for English (where RAlt+key is supposed to type German characters and various typographics).
To do that, I created two files, /usr/share/X11/xkb/symbols/moo_us and /usr/share/X11/xkb/symbols/moo_ru.
This is the command I use to set up layouts:
setxkbmap -option grp:switch,grp:caps_toggle,grp_led:caps,lv3:ralt_switch moo_us,moo_ruHere is my moo_us file:
default partial alphanumeric_keys
xkb_symbols "basic"
{
name[Group1] = "English (mooskagh)";
include "us(basic)"
key <AB03> { [ NoSymbol, NoSymbol, degree, U2103 ] }; // c C ° ℃
key <AB05> { [ NoSymbol, NoSymbol, enfilledcircbullet, enopencircbullet ] }; // b B • ◦
key <AB10> { [ NoSymbol, NoSymbol, division ] }; // / ? ÷
key <AC01> { [ NoSymbol, NoSymbol, adiaeresis, Adiaeresis ] }; // a A ä Ä
key <AC02> { [ NoSymbol, NoSymbol, ssharp, U1E9E ] }; // s S ß ẞ
key <AC04> { [ NoSymbol, NoSymbol, NoSymbol, U2109 ] }; // f F ℉
key <AC06> { [ NoSymbol, NoSymbol, leftarrow, U2194 ] }; // h H ← ↔
key <AC07> { [ NoSymbol, NoSymbol, downarrow, U2195 ] }; // j J ↓ ↕
key <AC08> { [ NoSymbol, NoSymbol, uparrow ] }; // k K ↑
key <AC09> { [ NoSymbol, NoSymbol, rightarrow ] }; // l L →
key <AD04> { [ NoSymbol, NoSymbol, radical, U221B ] }; // r R √ ∛
key <AD07> { [ NoSymbol, NoSymbol, udiaeresis, NoSymbol ] }; // u U ü
key <AD08> { [ NoSymbol, NoSymbol, infinity ] }; // i I ∞
key <AD09> { [ NoSymbol, NoSymbol, odiaeresis, Odiaeresis ] }; // o O ö Ö
key <AE01> { [ NoSymbol, NoSymbol, onesuperior ] }; // 1 ! ¹
key <AE02> { [ NoSymbol, NoSymbol, twosuperior, onehalf ] }; // 2 @ ² ½
key <AE03> { [ NoSymbol, NoSymbol, threesuperior, threequarters ] }; // 3 # ³ ¾
key <AE04> { [ NoSymbol, NoSymbol, U2074, onequarter ] }; // 4 $ ⁴ ¼
key <AE05> { [ NoSymbol, NoSymbol, U2075, onefifth ] }; // 5 % ⁵ ⅕
key <AE06> { [ NoSymbol, NoSymbol, U2076, onesixth ] }; // 6 ^ ⁶ ⅙
key <AE07> { [ NoSymbol, NoSymbol, U2077, U2150 ] }; // 7 & ⁷ ⅐
key <AE08> { [ NoSymbol, NoSymbol, U2078, multiply ] }; // 8 * ⁸ ×
key <AE09> { [ NoSymbol, NoSymbol, U2079 ] }; // 9 ( ⁹
key <AE10> { [ NoSymbol, NoSymbol, U2070 ] }; // 0 ) ⁰
key <AE11> { [ NoSymbol, NoSymbol, Armenian_en_dash, Armenian_em_dash ] }; // - _ – —
key <AE12> { [ NoSymbol, NoSymbol, U2248, plusminus ] }; // = + ≈ ±
key <LSGT> { [ U2610, U2611, U2612 ] }; // ☐ ☑ ☒
key <TLDE> { [ NoSymbol, NoSymbol, notequal, Armenian_section_sign ] }; // ` ~ ≠ §
include "level3(ralt_switch)"
};In Russian layout, it works as expected. However, in English layout, holding RAlt temporarily switched layout to Russian instead of working as a level3 shift.
The same configuration used to work in Arch ~one year ago, and still works in Debian.
Could you give me a hint how to disable that RAlt behavior? I couldn't find where it comes from.
Running xev -event keyboard and pressing/releasing RAlt, shows the following:
KeyPress event, serial 28, synthetic NO, window 0x1600001,
root 0x1d9, subw 0x0, time 10581217, (545,579), root:(3428,582),
state 0x0, keycode 108 (keysym 0xff7e, Mode_switch), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x1600001,
root 0x1d9, subw 0x0, time 10581529, (545,579), root:(3428,582),
state 0x2000, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: FalseAs you can see, KeyPress acts as Mode_switch (that's what I'd like to avoid), and KeyRelease is correctly working as ISO_Level3_Shift.
Thanks!
Last edited by crem (2023-10-13 12:33:43)
Offline
Quite surprising, but ChatGPT was able to tell the solution immediately.
The problem was in the grp:switch in my setxkbmap command. I removed it, and everything works as I expected.
setxkbmap -option '' -option grp:caps_toggle,grp_led:caps,lv3:ralt_switch moo_us,moo_ruOffline
Did ShitGPT also tell you how you came up w/ the idea itfp?
grep grp /usr/share/X11/xkb/rules/base.lstOffline
It didn't, but likely I just copied it somewhere from internet, there are hundreds of sites who seem to copy the command line from one another without fully understanding it (like I did, too):
Examples:
https://www.reddit.com/r/i3wm/comments/ … ock_in_i3/
https://askubuntu.com/questions/184242/ … simultaneo
Offline