Skip to content

Keep the key that wakes a blanked lock out of the password - #589

Merged
maralcbr merged 6 commits into
quattro-upstreamfrom
mac/87-wake-key
Sep 26, 2026
Merged

maralcbr merged 6 commits into
quattro-upstreamfrom
mac/87-wake-key

Conversation

@maralcbr

@maralcbr maralcbr commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Owner report on the M2 (image 2 + #583): the lock blanks its panel a few seconds after locking; the key pressed only to bring the screen back went into the password field, so the next attempt failed. Hyprland turns the panels on for any key (key_press_enables_dpms, on in Omarchy's input config) and still delivers that key to the focused field.

The lock already tracks that it blanked the panels (displaysBlank). A key pressed while any panel is dark now requests the wake and is swallowed, as are auto-repeats of that key if held; the next key is typed. Text an input method commits while dark is dropped the same way. A lit lock types every key as before. So a stale blank flag can't eat a real first character, the lock also wakes itself after resume (a one-second timer notices the wall-clock jump the frozen shell missed) and on a scroll, like it already did for pointer motion. Same approach as open upstream omacom#9211, plus the multi-monitor handling below. Generic, not Apple-specific. #583's focus recovery is untouched.

Multi-monitor (first owner check failed with a USB-C monitor attached): DPMS off makes the Asahi USB-C head drop its hotplug line and reconnect lit a second later (kernel log, every blank), while the built-in panel stays dark. The lock dropped its blank state on any screen change, and keyboard focus was on the external's lock surface, so the wake key was typed. Now a screen change asks Hyprland which panels are dark and keeps the blank state while any enabled one is; the wake key is judged by "any panel dark", not by the focused surface's panel. The external staying lit is the driver's behaviour; the lock doesn't re-blank it, since that would loop. The settle outcome is logged (blank-settled: ...).

Tests: lock-wake-key covers the wake-key state machine, the input-method path and a lit focused surface with another panel dark (live Quickshell fixture), and runs the service's own DPMS settle functions against the M2 case, all-lit, clamshell and unreadable answers. Key handler order and resume watch are pinned by source checks. It and the existing lock-*, sleep-lock, system-lock, hyprland-session-locked and apply-lock suites pass on an x86 Omarchy host with a live Hyprland compositor.

Second review (two rounds): no blocking defects. Fixed: scroll wake; settle logging. Remaining minor: with a video wallpaper, a DPMS poll racing the blank can let one key through; a failed dpms off or a clock step costs at most one key or a few lit seconds.

Owner check on the M2, with and without the USB-C monitor: lock (Super+Ctrl+L), wait ~10 s for the built-in panel to go dark (the external may come back lit on its own), press a letter: panel lights, field stays empty; type the password: unlocks. Then lock and type the password straight away while lit: unlocks first try. Optional: lock, let it blank, Suspend from the system menu, wake, type the password without touching the trackpad: unlocks.

maralcbr and others added 6 commits September 26, 2026 19:23
The lock blanks its panels a few seconds after locking. Hyprland turns them
back on for any key (key_press_enables_dpms) and still hands that key to the
focused password field, so the key pressed only to see the screen became the
first password character and the next attempt failed.

The view already knows its panel is blank. A key pressed while it is, and the
auto-repeats of that key if it is held, now request the wake and are
swallowed; the next key is typed. Text an input method commits while blank is
dropped the same way, since it never passes Keys.onPressed. A lit lock types
every key as before.

Same approach as the view change in omacom#9211.
Suspend freezes the shell, so a lock that blanked its panel before sleep still
thinks it is blank after resume, even though the panel is usually lit again.
The first password key would then be swallowed as a wake key. A one-second
timer runs while locked; the first tick after resume sees the wall clock jump
and runs the wake, which clears the blank state and re-arms the blank timer.

Same as the resume watch in omacom#9211.
On the M2 with a USB-C monitor, DPMS off makes the Asahi USB-C head drop its
hotplug line and come straight back lit, while the built-in panel stays dark.
The lock gave up its blank state on any screen change, so the key that woke
the built-in panel was typed into the password.

A screen coming back now asks Hyprland which panels are dark and keeps the
blank state while any is. The wake key is judged by whether any panel is dark,
not by the panel whose lock surface holds keyboard focus, since Hyprland lights
every panel for that key.
The video wallpaper test pinned the old rule that any screen change gives up
the blank state. A screen change now asks Hyprland which panels are lit, which
still keeps a visible wallpaper from freezing.
@maralcbr
maralcbr merged commit 1937418 into quattro-upstream Sep 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant