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
21.07k stars 881 forks source link

Modifier keys not working on some keys #3295

Open OreoLamp opened 1 year ago

OreoLamp commented 1 year ago

Hyprland Version

Hyprland, built from branch main at commit 84f8f4d77ddf4b6c772459584234e1f8f9d5f2ce dirty (keybinds: warp cursor to correct window in moveWindowOutOfGroup (3290)). Tag: v0.29.1-68-g84f8f4d7 flags: (if any)

Bug or Regression?

Bug

Description

Modifier keys do not work with some keys, specifically the < and ' keys. I am using a Finnish layout pc105 keyboard, and this bug is hardware-specific, verified that all works as expected (no bugs) on another Finnish pc105 layout keyboard. Specific keyboard model: Kingston HyperX Alloy FPS Mechanical Gaming Keyboard Attaching a part of a wev log that shows what happens in Hyprland, essentially, the modifier keys show normal pressed events, but when the < or ' keys are pressed with the modifier key, the modifier key does not show up as pressed despite there not being an event to lift the modifier key. This behavior seems to happen only in Hyprland (although I would love to test this in more environments to help debug this), as Sway does not have this issue (at least for me). I have however encountered similar behavior in Fedora KDE, although there this only seemed to effect qt-based applications. This bug currently makes Hyprland effectively unusable for me, as I cannot type '*', '|', or '>', which are rather inconvenient symbols to be missing while using the terminal.

How to reproduce

Plug my keyboard in (bug is hardware-specific xd) Open a terminal in Hyprland Press shift + < Expected behavior: A '*' character appears Observed behavior: A '<' character appears

Crash reports, logs, images, videos

wev_output.txt wl_keyboard.txt

The important part in wev_output.txt is here, the rest is just there to demonstrate that other keys work properly


[14:     wl_keyboard] key: serial: 2118; time: 1656855; key: 50; state: 1 (pressed)
                      sym: Shift_L      (65505), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000001: Shift 
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] keymap: format: 1 (xkb v1), size: 64893
[14:     wl_keyboard] repeat_info: rate: 25 keys/sec; delay: 600 ms
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 2121; time: 1657115; key: 94; state: 1 (pressed)
                      sym: less         (60), utf8: '<'
vaxerski commented 1 year ago

wouldnt that be a problem with the keyboard / layout? How is this a hyprland issue?

What about sway-git?

OreoLamp commented 1 year ago

I don't know what this is a problem with, but so far I haven't found other things this would be a problem with, other than Hyprland. I don't know where else to report this, I'd be happy to report this somewhere else if I knew where. If you have ideas on how to narrow the cause of this bug down, I'm more than happy to test basically whatever. Keyboard layout works just fine in sway-git, and wev output shows the modifier keys correctly as pressed when using them in combination with the keys that don't work in Hyprland. Going to try to test a few more Wayland compositors just to try to narrow the cause of the problem down. EDIT: Keyboard layout works without issues in Weston and KDE Plasma Wayland, testing other wayland compositors

OreoLamp commented 1 year ago

OK, so after a bunch of testing the problem seems to also occur in river, and after cross-referencing the dependency trees of sway, weston, hyprland, and river, I have a list of packages that hyprland and river depend on, but sway and weston do not. That list contains the following packages:

libepoxy
libfontenc
libsystemd.so=0-64
libxcvt
libxfont2
libxkbfile
libxrandr
nettle
xorg-fonts-encodings
xorg-server-common
xorg-setxkbmap
xorg-xkbcomp
xorg-xwayland

The main thing that makes this all a lot more confusing is all of those packages are also dependencies of KDE, where (at least on arch) modifier keys work just fine for all keys, including the problematic ones in river and hyprland. However, I think this might be because KDE doesn't actually use those packages on wayland, and they just come with the package. I'll try to test a few more compositors to try to pinpoint the issue.

yurumi commented 1 year ago

Hi @OreoLamp, have you made any progress on this? I'm pretty much in the same situation: I'm using a keymouse (two separated units with each half a keyboard) with some custom layout (modified neo2). The shift modifiers only work for the unit on which the key is pressed that should be in upper case. Shift + key on the other unit results in a lower case character. The wev output provides the same result as you stated above. With sway there are no problems. I haven't tried other compositors yet as I really would love to use hyprland.

OreoLamp commented 11 months ago

Hi @yurumi , sadly I haven't really had time recently to look into this. I should be able to make progress with this soon, but due to how annoying this bug is to figure out, don't hold your breath lol. Any help would be appreciated, as this bug for me is hardware-specific.

tdislay commented 4 months ago

Hi ! Same problem here Layout fr, default variant, nothing fancy, fresh install.

On my main computer: Keyboard 1 [G.Skill RIPJAWS KM780 MX]: modifier keys working in Gnome Wayland, in Sway, in TTY, but NOT in Hyprland (same key) Keyboard 2 [a DELL generic keyboard]: modifier keys working everywhere, even in Hyprland

AND same observation on my laptop..

From xkbcli on my laptop, same results on my main computer On gnome (everything's working fine)

# Keyboard 1
keycode [ LSGT ] keysyms [ greater ] unicode [ > ] layout [ French (0) ] level [ 1 ] mods [ -Shift Mod2 ] leds [ Num Lock ]

# Keyboard 2
keycode [ LSGT ] keysyms [ greater ] unicode [ > ] layout [ French (0) ] level [ 1 ] mods [ -Shift Mod2 ] leds [ Num Lock ]

On Hyprland (Keyboard 1 not working as expected)

# Keyboard 1 (notice how the modifier "-Shift" is being absent)
keycode [ LSGT ] keysyms [ less ] unicode [ < ] layout [ French (0) ] level [ 0 ] mods [ Mod2 ] leds [ Num Lock ]

# Keyboard 2
keycode [ LSGT ] keysyms [ greater ] unicode [ > ] layout [ French (0) ] level [ 1 ] mods [ -Shift Mod2 ] leds [ Num Lock ] 

As a fullstack dev, it's just IMPOSSIBLE for me to use a DE where I can't type the ">" symbol (especially when writing html) :/.