Repository navigation
Conversation
sachahjkl
added a commit
to sachahjkl/ShojiWM
that referenced
this pull request
Nov 13, 2026
The compositor owns the xkb state and never set Num Lock, so every session started with it off. The global keyboard config's numLock sets it once when the session starts (on, off), or puts back the state saved at the end of the last session (restore: $XDG_STATE_HOME/shoji_wm/num-lock, read and written off the event loop). A keymap change keeps the Num Lock state instead of resetting it, and setting it updates the LEDs and the focused client.
sachahjkl
force-pushed
the
feat/keyboard-num-lock
branch
from
November 16, 2026 22:10
9c2d5e5 to
fd7a358
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The compositor owns the xkb state and never sets Num Lock, so every session starts with it off. Hyprland has
numlock_by_default, KDE "Num Lock on startup", and Windows restores the last state.This adds
numLock?: "on" | "off" | "restore"to the keyboard input config (global only: there is one seat keyboard state)."on"/"off": set once when the session starts, never again on a config reload or a new device, so the user's own toggling is kept."restore": the state is saved when it changes to$XDG_STATE_HOME/shoji_wm/num-lock(next to the logs), and put back at the next session start. Reading and writing happen off the event loop (a reader thread answering through a calloop channel; one writer thread that writes only the latest state, through a temp file and a rename). A missing file leaves the state as it is.set_xkb_config/set_keymap_from_stringcreate a newxkb::State) keeps the Num Lock state when the option is set, instead of resetting it.KeyboardHandle::set_modifier_state, then advertises the modifiers to the focused client and updates the LEDs (led_state_changed), whichset_modifier_statealone does not do.Note: smithay's
set_modifier_statemasks the layout index withSTATE_LAYOUT_*flags, which would switch a multi-layout user back to layout 0; the active layout is read first and put back.Docs:
configuration/input.md(EN and JA).Tests:
wevas the focused client: with"on"the client's firstmodifiersevent haslocked: Mod2; with"restore"and no file the state is left off, and a press of Num Lock writesonto the file.I have not tested it on a DRM session with a hardware LED yet.