Skip to content

Key modifier maps with multiple modifiers do not allow parse/serialize roundtrip #1052

Description

@Twey

If I remap a shift key:

# symbols/remappedshift
default partial alphanumeric_keys
xkb_symbols "basic" {
    include "us(basic)"
    name[Group1]= "Remapped shift keys";
    key <LFSH> {	[ Alt_L ] };
    modifier_map Mod1 { <LFSH> };
};

then if I run

xkbcli compile-keymap \
    --include . \
    --include-defaults \
    --layout remappedshift \
| xkbcli interactive-wayland

and press <LFSH> with e.g. a then xkbcli interactive-wayland says:

Hyprland: key down [ LFSH ] keysyms [ Alt_L                           ] unicode [   ] layout [ #0 Remapped shift keys ] level [ 0 ] mods [ ] leds [  ] 
Hyprland: state    [ depressed-mods: 0x00000008; effective-mods: 0x00000008; ]
Hyprland: key down [ AC01 ] keysyms [ a                               ] unicode [ a ] layout [ #0 Remapped shift keys ] level [ 0 ] mods [ Mod1 Alt Meta ] leds [  ] 
Hyprland: key up   [ AC01 ] 
Hyprland: key up   [ LFSH ] 
Hyprland: state    [ depressed-mods: 0x00000000; effective-mods: 0x00000000; ]

Now if I copy it to $XDG_CONFIG_HOME and load it as a Wayland layout (I'm using Hyprland) and try the same thing without the pipe, the resulting keystroke is the shifted variant, though it includes the -Shift modifier:

Hyprland: key down [ LFSH ] keysyms [ Alt_L                           ] unicode [   ] layout [ #1 Remapped shift keys ] level [ 0 ] mods [ ] leds [ Group 2 ] 
Hyprland: state    [ depressed-mods: 0x00000009; effective-mods: 0x00000009; ]
Hyprland: key down [ AC01 ] keysyms [ A                               ] unicode [ A ] layout [ #1 Remapped shift keys ] level [ 1 ] mods [ -Shift Mod1 Alt Meta ] leds [ Group 2 ] 
Hyprland: key up   [ AC01 ] 
Hyprland: key up   [ LFSH ] 
Hyprland: state    [ depressed-mods: 0x00000000; effective-mods: 0x00000000; ]

(Applications seem to ignore the -Shift and treat this the same as Alt+Shift+s.)

I don't know whether there is a correct way to remap modifiers like this, but I would expect the behaviours here to be the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompile-keymapIndicates a need for improvements or additions to keymap compilationdump-keymaptools: interactive

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions