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

Not tracking num lock or caps lock for progressive enhancement #7937

Closed
elijahimmer opened this issue Apr 29, 2024 · 6 comments
Closed

Not tracking num lock or caps lock for progressive enhancement #7937

elijahimmer opened this issue Apr 29, 2024 · 6 comments

Comments

@elijahimmer
Copy link

I'm not sure if it's specifically alacritty's job, winit, or something else, but the num lock and caps lock state is not being tracked.

When you type the modifier, it says it changes the modifier state, but that state is actually left unchanged.
I put logs at the bottom, and neither caps lock, nor num lock change the modifier keys state.
the message makes it seem like it's on winit's side, but I didn't want to go upstream without checking first because I don't know enough.

Normally, I don't see this being an issue, but kitty's Progressive Enhancement is supposed to send it as a part of the modifiers on a key.
https://sw.kovidgoyal.net/kitty/keyboard-protocol/#modifiers

(the modifiers themselves still work as expected, they are just not tracked properly)

I also wanted to test the hyper and meta keys (as in the spec) but I honestly don't know what those keys are, how they are different than super, or how I would even send them.

Wonderful terminal, thanks for all your hard work.

System

OS: Linux Nixos unstable
Version: alacritty 0.13.2
On Hyprland

Logs

neither actually change the modifier state when pressed, while other mods do. (not tested with hyper or super)

num lock:

[12.885738689s] [INFO ] [alacritty] winit event: AboutToWait
[13.740766684s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 12624, tv_nsec: 881716804 }, requested_resume: None })
[13.740794233s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(NumLock), logical_key: Named(NumLock), text: None, location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(NumLock), text_with_all_modifiers: None } }, is_synthetic: false } }
[13.740817533s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) }
[13.740828393s] [INFO ] [alacritty] winit event: AboutToWait
[13.875727828s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 12625, tv_nsec: 736813418 }, requested_resume: None })
[13.875742238s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(NumLock), logical_key: Named(NumLock), text: None, location: Standard, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(NumLock), text_with_all_modifiers: None } }, is_synthetic: false } }
[13.875752338s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) }

caps lock:

[526.298392846s] [INFO ] [alacritty] winit event: AboutToWait
[550.647884873s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 13138, tv_nsec: 769398013 }, requested_resume: None })
[550.647911312s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(CapsLock), logical_key: Named(CapsLock), text: None, location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(CapsLock), text_with_all_modifiers: None } }, is_synthetic: false } }
[550.647927771s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) }
[550.647946090s] [INFO ] [alacritty] winit event: AboutToWait
[550.772885814s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 13162, tv_nsec: 643926734 }, requested_resume: None })
[550.772901093s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(CapsLock), logical_key: Named(CapsLock), text: None, location: Standard, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(CapsLock), text_with_all_modifiers: None } }, is_synthetic: false } }
[550.772911032s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) }

specifically:

[13.740817533s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) }

and

[550.647927771s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94480347571344)), event: ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) }

when the keys are pressed, and the modifier state says it has changed, but doesn't actually change.
what shift outputs:

[2.044116227s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94382563673152)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(ShiftLeft), logical_key: Named(Shift), text: None, location: Left, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(Shift), text_with_all_modifiers: None } }, is_synthetic: false } }
[2.044130737s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94382563673152)), event: ModifiersChanged(Modifiers { state: ModifiersState(SHIFT), pressed_mods: ModifiersKeys(0x0) }) }
[2.044138717s] [INFO ] [alacritty] winit event: AboutToWait
[2.706087735s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 14954, tv_nsec: 781752633 }, requested_resume: None })
[2.706114135s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94382563673152)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(ShiftLeft), logical_key: Named(Shift), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(Shift), text_with_all_modifiers: None } }, is_synthetic: false } }
[2.706130715s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94382563673152)), event: ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) }
[2.706141385s] [INFO ] [alacritty] winit event: AboutToWait

this line shows the SHIFT mod being pressed:

[2.044130737s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94382563673152)), event: ModifiersChanged(Modifiers { state: ModifiersState(SHIFT), pressed_mods: ModifiersKeys(0x0) }) }
@chrisduerr
Copy link
Member

This is specifically just about the Kitty keyboard protocol, right?

I see no reason to track num lock or caps lock keys and I'd consider these optional (they're a progressive enhancement after all). Terminal application should not concern themselves with these keys.

@kchibisov
Copy link
Member

yeah, this is all in the context of kitty protocol, because they are also modifiers.

@elijahimmer
Copy link
Author

yes, like kchibisov said, It was just something in the kitty protocol that wasn't supported so I thought I would bring it up.

@chrisduerr
Copy link
Member

I believe @kchibisov intentionally left that out and I don't see a reason to change it.

@kchibisov
Copy link
Member

Forwarding is not a big deal when we have events, but as of now there's no way to do so, and I'm not sure why you want to treat capslock specially.

@chrisduerr
Copy link
Member

Forwarding is not a big deal when we have events, but as of now there's no way to do so, and I'm not sure why you want to treat capslock specially.

Giving applications to use something they shouldn't is honestly worse than not forwarding it at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants