Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot bind to numeric numpad keys #2682

Closed
jonhoo opened this issue Jul 11, 2023 · 3 comments
Closed

Cannot bind to numeric numpad keys #2682

jonhoo opened this issue Jul 11, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@jonhoo
Copy link

jonhoo commented Jul 11, 2023

9999999It appears that Hyprland is only able to bind against the non-numlocked variants of a numpad.

To reproduce, add the following to a Hyprland config:

bind = , KP_2, exec, notify-send 'kp_2'
bind = , KP_DOWN, exec, notify-send 'kp_down'

Then, try to press the "2" key on the numpad with num lock turned on and off. Regardless of whether it's on or off, the notification is always kp_down. What's particularly weird is that wev produces the correct key codes for the events (here pressing "2" with numlock off, then turning on numlock, then pressing "2", then turning numlock off, then pressing "2"):

[14:     wl_keyboard] key: serial: 31822; time: 17411438; key: 88; state: 0 (released)
                      sym: KP_Down      (65433), utf8: ''
[14:     wl_keyboard] key: serial: 31823; time: 17413358; key: 77; state: 1 (pressed)
                      sym: Num_Lock     (65407), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000010: Mod2
                      latched: 00000000
                      locked: 00000010: Mod2
[14:     wl_keyboard] key: serial: 31825; time: 17413430; key: 77; state: 0 (released)
                      sym: Num_Lock     (65407), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000010: Mod2
[14:     wl_keyboard] key: serial: 31827; time: 17415462; key: 88; state: 0 (released)
                      sym: KP_2         (65458), utf8: ''
[14:     wl_keyboard] key: serial: 31828; time: 17418782; key: 77; state: 1 (pressed)
                      sym: Num_Lock     (65407), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000010: Mod2
                      latched: 00000000
                      locked: 00000010: Mod2
[14:     wl_keyboard] key: serial: 31830; time: 17418862; key: 77; state: 0 (released)
                      sym: Num_Lock     (65407), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 31832; time: 17420126; key: 88; state: 0 (released)
                      sym: KP_Down      (65433), utf8: ''

So I'm not entirely sure how Hyprland gets confused here.

I have noticed that the numlock LED sometimes changes somewhat randomly in Hyprland when I press numpad keys combined with modifiers. For example, if you don't have a keybind for SUPER + KP_9, and have num lock turned off, then pressing SUPER + the 9 key on the numpad will turn num lock on for as long as SUPER is held down. Which feels wrong.

@jonhoo jonhoo added the bug Something isn't working label Jul 11, 2023
@vaxerski
Copy link
Member

image

This is why. Numlock state is not committed to the keybind map. It's the same reason why you can do

bind = SHIFT, 1, exec, amongus

and you dont have to do

bind = SHIFT, exclam, exec, amongus

@jonhoo
Copy link
Author

jonhoo commented Jul 12, 2023

Huh, I don't see that warning on https://wiki.hyprland.org/Configuring/Binds/ ? Where is it located?

Does this mean that numlock is considered a modifier then? Can I use https://github.com/xkbcommon/libxkbcommon/blob/0d01a933bba047c7e4a3312fd2c8c6accc563823/include/xkbcommon/xkbcommon-keysyms.h#L211 or something like it in the MOD list?

@jonhoo
Copy link
Author

jonhoo commented Jul 12, 2023

Looking at https://wiki.hyprland.org/Configuring/Variables/#variable-types, numlock isn't among the valid MODs, so unless I'm mistaken this means it's not possible currently to bind numeric numpad keys. Including through something like pass, which means they can't be forwarded to other applications either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants