Repository navigation
Accept keypad digits on the lock screen while NumLock is desynced - #12667
prabhchintan wants to merge 3 commits into
Conversation
Typing a digit on the numeric keypad does nothing in the lock screen's password field, while the same digit on the number row types fine. Qt never reads the compositor's NumLock state at startup (QTBUG-32687), so even with NumLock on the keypad reaches the field as Home, Up, PageUp and the rest with KeypadModifier set and no text, and the field treats them as cursor movement. Anyone whose password has digits typed on the keypad has to toggle NumLock off and on at every lock. Map those keys back to their digits in the field's key handler when KeypadModifier is set. Digits that already carry text, the top row, and plain cursor keys are untouched, and nothing is inserted while the field is read-only during authentication. Same approach as omacom#10530 for the polkit dialog; the lock keeps its own model so the two can land independently. Fixes the lock screen half of omacom#8552. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
One layout-dependent limitation remains in the keypad workaround at Verified by source inspection: keypad navigation-key events map to digits, while ordinary number-row/navigation keys pass through and the read-only guard prevents insertion during authentication. The decimal key becomes the wrong character on comma layouts
Source-derived comparison, not a live keyboard test:
Impact: a password containing a keypad-entered comma still cannot be entered correctly through this workaround. Unlike the baseline's lack of character insertion, the field now gains a masked character, making the wrong separator less apparent. This is incomplete layout support, not a newly introduced authentication failure. Suggested change: avoid assuming Review informationTest scope: source inspection of the pinned change, lock-service wiring, xkeyboard-config symbol definitions and Qt 6.11.2 key mapping. No runtime tests, live lock/PAM authentication or physical-keyboard validation were performed. The handler also converts keypad navigation when NumLock is intentionally off; dedicated navigation keys remain unaffected. Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra Medium initial inspection, independent Opus 5.5 High and GPT 6 Sol Xhigh technical reviews, followed by Astra Medium synthesis and verification against source evidence. |
It arrives as Delete on every layout but types "." on some and "," (KP_Separator) on others, which the desynced event cannot tell apart.
|
Good catch, and verified here against xkeyboard-config: the German keypad's decimal key is KP_Separator at level one, so a desynced Delete cannot be mapped to a single character safely. Dropped the decimal key from the mapping in the follow-up commit; the digits, which #8552 is about, still type, and the decimal key falls through to the field as before. Test updated to pin that. |
Automated AI review
Follow-up to the earlier review and the author's reply, checked at Resolved: the keypad decimal key no longer types Verified with a Qt 6.11.2 test harness that drives the real
The reply's "falls through to the field as before" is accurate. While desynced, the decimal key arrives as Delete with no text on both dot and comma layouts, and the field handles it as a forward delete, as on the base branch. With the cursor at the end and nothing selected it changes nothing, so a password containing a keypad decimal still needs NumLock toggled. For example, keypad The earlier verified statements still hold at this head: desynced keypad keys type digits, the number row and dedicated navigation keys pass through, and nothing is inserted while authenticating. The branch merges cleanly with the current Keypad digits do not replace a selectionThis is present since
Impact: selecting the password to retype it with keypad digits submits the old text plus the new digits. The attempt fails, and in the masked field the cause is easy to miss. Suggested change: remove the selection before inserting: if (passwordInput.selectionStart !== passwordInput.selectionEnd)
passwordInput.remove(passwordInput.selectionStart, passwordInput.selectionEnd)In the same harness this makes the Ctrl+A case type Optional test improvement: Documentation: the PR description's test plan still says keypad Home, End and Delete type Related open PRs: #11072 also adds Review informationTest scope: source inspection of the new head, the previously reviewed head and the base, with Qt 6.11.2, libxkbcommon 1.13.2 and xkeyboard-config 2.48. The PR's test was run in an isolated sandbox at the head and on a simulated merge with the current base. A Qt 6.11.2 QML test harness drove AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
TextInput.insert() leaves an existing selection in place, while typed text replaces it, so selecting the password and retyping it with keypad digits submitted the old text plus the new digits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed by Claude Opus 5.5 and verified on a disposable Omarchy worker. The fix works, and I pushed one small correction to your branch. Reproduced. A Quickshell harness drove the real Pushed b164715: a keypad digit now replaces a selection. Tests on the worker: No second opinion yet. The second reviewer, Codex Medium, answers, but omabot's daily review budget was spent before it reached this pull request, so nothing has checked this review. It stays short of ready until a later run gets a second opinion on this head. #8552 is not linked as fixed, because it also covers the polkit dialog (#10530) and the launcher. Waiting on the second opinion, then on the maintainer. |
|
| if (passwordInput.readOnly || !(event.modifiers & Qt.KeypadModifier)) return false | ||
| var digit = LockModel.keypadDigit(event.key) | ||
| if (digit === "") return false | ||
| // insert() keeps a selection where typing replaces it. | ||
| if (passwordInput.selectionStart !== passwordInput.selectionEnd) passwordInput.remove(passwordInput.selectionStart, passwordInput.selectionEnd) | ||
| passwordInput.insert(passwordInput.cursorPosition, digit) |
There was a problem hiding this comment.
Keypad navigation inserts digits
If a user deliberately turns NumLock off and presses keypad Home, End, or an arrow key to move the cursor, this handler inserts a digit instead. Shift- and Control-modified keypad navigation is intercepted too, so moving the cursor or extending a selection can change the password.
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
There was a problem hiding this comment.
Keypad handler remains untested
This test calls only the JavaScript keycode mapping; it never sends a key through the lock screen's password field. A regression in the new modifier check, selection replacement, or read-only guard could therefore pass the test while keypad input behaves incorrectly.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Independent confirmation from another affected setup, in case it helps move this forward. Omarchy 7.2.8, Hyprland, ASUS laptop + external USB keyboard. After a real suspend/resume the lock screen keypad types navigation keys (KP_7 → Home, KP_4 → ←…) while I'm running a local patch that does essentially what this PR does (map On the Greptile P1 (user deliberately has Num Lock off): on a password field I don't see that as a practical problem, since the keypad navigation keys have no use there. Related: #8552, #12438, and PR #12435 (which explains that every suspend removes/re-adds the input devices, clearing Qt's state). |
Problem
Typing a digit on the numeric keypad does nothing in the lock screen's password field. The same digit on the number row types fine. Anyone whose password has digits typed on the keypad has to toggle NumLock off and on at every lock (#8552).
Cause
Qt never reads the compositor's NumLock state at startup (QTBUG-32687). Even with NumLock on, the keypad reaches the field as Home, Up, PageUp and the rest with
Qt.KeypadModifierset and no text, andTextInputtreats them as cursor movement.Fix
Map those keys back to their digits in the field's key handler when
KeypadModifieris set. Digits that already carry text, the top row and plain cursor keys are untouched, and nothing is inserted while the field is read-only during authentication.Same approach as #10530 takes for the polkit dialog. The lock keeps its own model so the two can land independently; if both land, the two helpers can fold into one.
Test plan
test/shell.d/lock-keypad-test.shcovers the mapping and the keys that must stay untouchedLockViewfield: keypad Home, End and Delete type71., plain Home stays cursor movement,Key_7with text is left to the field, nothing is inserted while authenticatingpolkit,lock-*andmenushell tests pass