You are not logged in.

#1 2025-08-03 17:11:14

xzxADIxzx
Member
Registered: 2025-08-03
Posts: 3

XKB's option grp:lalt_lshift_toggle doesn't work as expected

As the name suggests, it should switch the layout when you press Left Shift + Left Alt, but it also switches the layout under other circumstances, namely when you press Right Alt + Left Shift or Right Shift + Left Alt.

The lalt_lshift_toggle option is defined in /usr/share/X11/xkb/symbols/group.

partial modifier_keys
xkb_symbols "lalt_lshift_toggle" {
    key <LALT> {[  NoSymbol,  ISO_Next_Group  ], type[group1] = "TWO_LEVEL" };
    key <LFSH> {[  Shift_L,   ISO_Next_Group  ], type[group1] = "PC_ALT_LEVEL2" };
};

So my guess is that Right Shift and Right Alt switch the level to the second one, which is why the result is ISO_Next_Group, but I don't know how to prevent this behavior.

Here is the result of "setxkbmap -print -verbose 10":

Setting verbose level to 10
WARNING: Running setxkbmap against an Xwayland server
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+inet(evdev)"	};
	xkb_geometry  { include "pc(pc105)"	};
};

Thanks in advance.

Offline

#2 2025-08-03 23:08:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,180

Re: XKB's option grp:lalt_lshift_toggle doesn't work as expected

WARNING: Running setxkbmap against an Xwayland server

setxkbmap has limited meaning on wayland and there's no group switch configured for xwayland at all

Where and how do you set " grp:lalt_lshift_toggle" and what wayland compositor is this specfically?

Offline

#3 2025-08-04 04:58:58

xzxADIxzx
Member
Registered: 2025-08-03
Posts: 3

Re: XKB's option grp:lalt_lshift_toggle doesn't work as expected

I'm using Hyprland; therefore, XKB's options are set in hyprland.conf:

input {
    kb_layout = us, ru
    kb_options = grp:lalt_lshift_toggle
}

Offline

#4 2025-08-04 07:22:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,180

Re: XKB's option grp:lalt_lshift_toggle doesn't work as expected

Test the behavior w/ an X11 session (ie. i3 or openbox will do) and then check "wev" on hyprland to make sure the keys generate different input.
I suspect a https://github.com/hyprwm/Hyprland/issues for operating on the modifiers rather than the keycode and whatever finger you use to press alt: it's still the same *modifier*

Offline

#5 2025-08-12 09:00:03

Wismill
Member
Registered: 2025-08-12
Posts: 8

Re: XKB's option grp:lalt_lshift_toggle doesn't work as expected

xzxADIxzx wrote:

WARNING: Running setxkbmap against an Xwayland server

setxkbmap -print

and

setxkbmap -query

do not work on Wayland: you will always get the same output, unless you previously used

setxkbmap

to set a keymap. You should use the libxkbcommon-tools package whenever dealing with XKB on Wayland, although currently there is no similar API.

The issue here is that the

grp:lalt_lshift_toggle

option adds a Shift level to the left Alt and an Alt level to the left Shift. These levels are activated by whatever Shift/Alt you have, not specifically the left ones.

There is unfortunately no easy workaround it, unless you are willing to edit advanced XKB features that work only on Wayland: make the left Alt and Shift triggers an additional virtual modifier

MyMod

, create key types that mimic

TWO_LEVEL

and

PC_ALT_LEVEL2

but using

MyMod

for the second level, and update replace the option. Note that you should put your custom files in

.

Offline

#6 2025-08-13 12:03:22

xzxADIxzx
Member
Registered: 2025-08-03
Posts: 3

Re: XKB's option grp:lalt_lshift_toggle doesn't work as expected

I see. Thank you for detailed answer.

Offline

Board footer

Powered by FluxBB