Repository navigation
Conversation
The server's virtual keyboard starts with no locked modifiers, and the first modifier change it sends clears the locks Hyprland gave it. With Num Lock on locally (Omarchy's default), the keypad typed navigation keys on the remote, and toggling Num Lock flipped both ends, so they stayed opposite. The client now sends its Caps Lock and Num Lock in a new Locks message when the keyboard starts going to a session: on connect, when the picture takes focus, and when the session's tab is shown. The server sets them on the virtual keyboard's state. It goes only to a server that lists the new lock-state feature. Fixes omacom#138. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCs6nfZCNssaXtUYR7cpHg
[Medium impact] The PR appears safe to merge, with the previous test gap addressed and no new findings. SummaryThe PR matches the remote keyboard’s Caps Lock and Num Lock to the client’s when a session connects or gains focus.
Reviews (2) · Last reviewed commit: "Test clearing locks and keeping the othe..." · Reviewed by Greptile |
set_locks clears Caps Lock and Num Lock as well as setting them, and leaves another locked modifier and the locked layout as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCs6nfZCNssaXtUYR7cpHg
|
We reproduced this from a Windows client (gliff-win) against stock gliff-server 0.4.3. On a new session the keypad types digits correctly, so the virtual keyboard does start with Num Lock on. After the first Caps Lock press is forwarded, the remote's Num Lock turns off, and keypad 1 2 3 8 then arrives as End, Down, PgDn and Up. Forwarding Num Lock once restores it. Caps Lock also drifts out of step with the client. A client-reported lock state like this PR adds would fix both for us. Happy to test once it lands. |
Fixes #138.
Problem
The server's virtual keyboard starts from a fresh
KeyStatewith no locked modifiers, and nothing told it the client's. With Num Lock on locally (Omarchy'snumlock_by_default), the keypad typed navigation keys on the remote. A Num Lock press toggles both ends, so they stayed opposite.Fix
gliff-proto: newClientMsg::Locks { caps, num }(variant 17) and the featurelock-stateinFEATURES. Following the rules inmsg.rs, the client sendsLocksonly to a server that lists the feature, so an older server never sees it. An older client simply never sends it.send_locksreads Caps Lock and Num Lock from the GDK seat keyboard (is_caps_locked,is_num_locked) and sends them whenever the keyboard starts going to a session: on connect, when the picture takes focus, and when that session's tab is shown.LocksbecomesInputCmd::SetLocks.KeyState::set_lockssets or clears only theLockandMod2bits, keeps the other locked modifiers, the depressed and latched ones and the layout, and the new state goes to the virtual keyboard as amodifiersrequest.The client does not send on every lock change. The lock key itself is forwarded and toggles both ends, and a message sent from the GDK notify could arrive before or after that key event, which would invert the lock again.
Testing
scripts/check.shpasses, with a new testkeymap::tests::set_locks_sets_num_lock_and_a_lock_key_still_toggles_it: Num Lock set while Ctrl is held keeps Ctrl, setting it again changes nothing, and a forwarded Num Lock press still toggles it off. A second test,set_locks_clears_and_leaves_other_locks_and_the_layout, sets and then clears both locks with Mod5 and the second layout locked, and checks those survive.In a nested Hyprland with
numlock_by_default = true, the server loggedclient locks caps=false num=trueon each focus of the picture. I did not verify keypad typing end to end: with client and server on one compositor, the server's keys come back to the client window. The firstLocksat connect saidnum=false, because a second window had keyboard focus at that moment. The send on focus corrected it before any key could be typed.The change was written with Claude Opus 5.5.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UCs6nfZCNssaXtUYR7cpHg