hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.51k stars 818 forks source link

Keyboard Mod Keys not working #1762

Open PatrickDaG opened 1 year ago

PatrickDaG commented 1 year ago

I'm using hyprland on a laptop with a german keyboard using layout :

input {
    kb_layout = de
   kb_variant = bone
}

This layout includes up to five different layers, being trigger by Mod keys. On the internal keyboard these work as intended, on an external keyboard however two of the modkey do not work correctly The corresponding keycodes from wev are: for layer 4:

[14:     wl_keyboard] key: serial: 65393; time: 25738659; key: 94; state: 1 (pressed)
                      sym: ISO_Level5_Shift (65041), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000020: Mod3 
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 65395; time: 25738749; key: 94; state: 0 (released)
                      sym: ISO_Level5_Lock (65043), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000000

and for layer 3:

[14:     wl_keyboard] key: serial: 65677; time: 25805948; key: 51; state: 1 (pressed)
                      sym: ISO_Level3_Shift (65027), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000080: Mod5 
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 65679; time: 25806068; key: 51; state: 0 (released)
                      sym: ISO_Level3_Shift (65027), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000000

wev returns the same keycodes on the internal keyboard, the only difference is when pressing the mod keys and then pressing another key, on the internal keyboard the correct layer key gets returned, on the external keyboard however the incorrect base layer key gets returned. The corresponding modkeys on the other side, think left_shift/right_shift, functions on both keyboards.

The only notable difference between the two keyboard is the internal laptop one has the physical layout of an American keyboard with German key bindings, meaning it is missing a right shift key and a menu key.

vaxerski commented 1 year ago

I think that'd be an issue with xkb and not hyprland?

PatrickDaG commented 1 year ago

The same settings worked without issue when using X11. Is there a difference when using xkb under X11 as opposed to wayland?

vaxerski commented 1 year ago

Hm. Odd. What does hyprctl devices say?

PatrickDaG commented 1 year ago
mice:
    Mouse at 1beded0:
        logitech-g-pro--1
            default speed: 0.000000
    Mouse at 1cc7870:
        kingston-hyperx-alloy-fps-mechanical-gaming-keyboard-mouse
            default speed: 0.000000
    Mouse at 1f658c0:
        kingston-hyperx-alloy-fps-mechanical-gaming-keyboard-consumer-control-1
            default speed: 0.000000
    Mouse at 1b9df10:
        syna329a:00-06cb:cd4f-mouse
            default speed: 0.000000
    Mouse at 43ac560:
        syna329a:00-06cb:cd4f-touchpad
            default speed: 0.000000

Keyboards:
    Keyboard at 1c65810:
        video-bus
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 1e1a9f0:
        video-bus-1
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 1ddbec0:
        power-button
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 4309a70:
        logitech-g-pro-
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 4308ed0:
        kingston-hyperx-alloy-fps-mechanical-gaming-keyboard
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 1f18a30:
        kingston-hyperx-alloy-fps-mechanical-gaming-keyboard-system-control
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 1e45150:
        kingston-hyperx-alloy-fps-mechanical-gaming-keyboard-consumer-control
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 1c7e780:
        kingston-hyperx-alloy-fps-mechanical-gaming-keyboard-1
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 1d38fa0:
        hp-wide-vision-fhd-camera:-hp-w
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 22210b0:
        hp-wide-vision-fhd-camera:-hp-i
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 20b23a0:
        intel-hid-events
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 21f1ff0:
        intel-hid-5-button-array
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 4455e40:
        at-translated-set-2-keyboard
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 4494570:
        wireless-hotkeys
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: no
    Keyboard at 44d2ea0:
        hp-wmi-hotkeys
            rules: r "", m "", l "de", v "bone", o ""
            active keymap: German (Bone)
            main: yes

Tablets:
    Tablet at 1b834c0:
        elan2514:00-04f3:2817-stylus

Touch:
    Touch Device at 1b7c7e0:
        elan2514:00-04f3:2817
    Touch Device at 1e96520:
        elan2514:00-04f3:2817-1

Switches:
    Switch Device at 2065a60:
        Lid Switch
    Switch Device at 43869a0:
        Intel HID switches
    Switch Device at 1d13400:
        HP WMI hotkeys
vaxerski commented 1 year ago

weird, all your kbs should be in the same keymap. No clue.

PatrickDaG commented 1 year ago

I have tested it with sway just now, and it works as intended, the mod keys actually changing layer.

PatrickDaG commented 1 year ago

After more trying it seems Mod keys in general are pretty broken. When switching keyboard layouts from my prefered de,bone layout to the standard de,de some Modkeys get mangled up. Such as CapsLock, suddenly having the same effect as right alt. The greater/less and hashtag key, the supposed modkeys under my layout, do not work at all on the external keyboard and internally it work but the key repeat is not applied making it seem there is still something wrong.

vaxerski commented 1 year ago

mods are governed by xkb

PatrickDaG commented 1 year ago

But given that it works without problem both in sway and under X11 I suspect the error lays in Hyprland. I have skimmed the source code of both hyprland and sway and there are differences in how they handle mod keys. Sadly I was not able to find the concrete bug that causes this.

romanstingler commented 6 months ago

@PatrickDaG
is this resolved

PatrickDaG commented 5 months ago

I've just tested it and the problem still remains. Two of the modkeys are not working and do nothing.

EinEtw4s commented 5 months ago

I currently have a very similar issue with NEO QWERTZ. When I set kb_variant to neo_qwertz in my config and keep kb_layout as de, it seems to have MOD3 (that is "<,>,|" on QWERTZ) inverted. This is putting me on another layer by default. I am in my "normal" home layer when I press that button. I checked this with wev. I do not have this issue in, for example, my login shell. The other modkeys seem to be working, but due to the aforementioned issue I cannot say that with 100% certainty.