Skip to content

core: defer unlock requests that arrive before the locked event - #1087

Open
martintrojer wants to merge 1 commit into
hyprwm:mainfrom
martintrojer:hl-defer-early-unlock
Open

martintrojer wants to merge 1 commit into
hyprwm:mainfrom
martintrojer:hl-defer-early-unlock

Conversation

@martintrojer

@martintrojer martintrojer commented Oct 28, 2026 •

Copy link
Copy Markdown

If an unlock request (SIGUSR1, fingerprint match, grace pointer motion) arrives before the compositor's locked event, fadeOutAndUnlock() sets m_fadeOutOrTerminate and then returns because it isn't locked yet. The PAM thread sees the flag and exits, the request is dropped, and after locked the correct password does nothing. Came in with 37f615c.

Now the request is remembered (m_unlockPending) and replayed from onLockLocked(). Grace pointer motion also returns while not locked (like onKey does), otherwise it would be replayed after grace had expired and unlock without a password.

Tested on a real build with headless sway and a proxy that holds back only locked: SIGUSR1 before locked is stuck on base, unlocks on locked with the patch. --grace 6, motion at t=0, locked at ~13 s: no free unlock, password works. Motion after locked still unlocks. Fingerprint not run, read from source only.

#1065 changes onLockLocked() too; its startFadeIn() should go before the replay.

fadeOutAndUnlock() set m_fadeOutOrTerminate before returning early
because the session was not locked yet. The PAM thread then exited and
the correct password no longer unlocked; the request itself was dropped.

Set the flag only once locked. Record the request and replay it from
onLockLocked(). Ignore grace pointer motion until locked, like onKey
already does, so it neither wedges PAM nor unlocks without a password
after the grace period has run out.
@martintrojer
martintrojer marked this pull request as ready for review October 28, 2026 10:34
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