Skip to content

Dismiss screensaver on bare Ctrl while it is open - #10587

Closed
fresh3nough wants to merge 1 commit into
omacom:quattrofrom
fresh3nough:fix/10583-screensaver-ctrl-wake
Closed

fresh3nough wants to merge 1 commit into
omacom:quattrofrom
fresh3nough:fix/10583-screensaver-ctrl-wake

Conversation

@fresh3nough

@fresh3nough fresh3nough commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #10583 (Ctrl-tap half only).

omarchy-screensaver exits on tty bytes (read -n1) or signals. Bare Ctrl is a modifier with no tty byte, so it never wakes the screensaver. Separately, idle's handleActiveSignal() intentionally ignores compositor activity while the screensaver window exists (to avoid self-close on launch).

v3.3.0 removed global mouse-to-wake for Bluetooth mice. This PR does not restore mouse wake.

Change

While an org.omarchy.screensaver window is open (tracked via window.open / close / destroy, same pattern as selection-layer binds):

  • Bind Control_L / Control_R with non_consuming = true and locked = true
  • On press: pkill -HUP -f '[o]rg.omarchy.screensaver' (hits the existing exit_screensaver SIGHUP trap)
  • Unbind when the last screensaver window closes

Uses press + non_consuming, not release = true: on Hyprland 0.56.2 bare-modifier release binds register but never dispatch (reproduced standalone; see review discussion).

Evidence

Bug reproduced

bin/omarchy-screensaver:
  trap ... SIGHUP ...
  if read -n1 -t 1 || ! screensaver_in_focus; then exit_screensaver; fi

shell/plugins/services/idle/Service.qml handleActiveSignal:
  if screensaverStartedThisCycle && screensaverWindowCount > 0 → return

Ctrl alone → no tty byte → no wake. Activity signal swallowed while window up.

Fix validated

bash test/shell.d/screensaver-ctrl-wake-test.sh
ok - screensaver traps SIGHUP for non-tty dismiss
ok - utilities binds Control_L/R press (non_consuming) to SIGHUP while screensaver is open
ok - utilities does not use release=true on bare Control screensaver binds
ok - utilities does not reintroduce global mouse screensaver wake
ok - screensaver wake bind lifetime tracks open screensaver windows

bash test/shell.d/system-lock-test.sh
ok - system lock waits for ttfx before closing its terminal

Test plan

  • Source/assert tests for bind lifetime, non_consuming, and no mouse wake
  • system-lock still closes screensaver correctly
  • Manual: omarchy-launch-screensaver force → tap Ctrl alone → dismisses
  • Out of scope here: mouse click wake (BT-mouse history); Alt/Super modifier wake

@victoralekseev5597

Copy link
Copy Markdown

Heads up on release = true for this: it doesn't fire at all on my machine (Hyprland 0.56.2, v0.56.2 tag, commit efb50993), for any bare modifier — not specific to Ctrl.

Reproduction

Isolated it with standalone debug binds, unrelated to the screensaver entirely:

o.bind("Control_L", "debug", "notify-send ctrl-release", { release = true })  -- never fires
o.bind("Super_L",   "debug", "notify-send super-release", { release = true }) -- never fires
o.bind("Control_L", "debug", "notify-send ctrl-press",   {})                  -- fires immediately

hyprctl binds -j shows all three registered correctly ("release": true present where expected), so it's not a config/registration problem — the release-triggered dispatch for a bare-modifier bind just never fires on this build, while press-triggered fires reliably. Confirmed Super+Space (a normal modifier+key combo) fires fine throughout, so this isn't "keybinds broken while the screensaver window is focused" either — it's specific to modifier-only, release-triggered binds.

What worked instead

Press-triggered with non_consuming = true, so the key still reaches the focused app normally (verified Ctrl+C/Ctrl+V and Super+Space all still work as expected afterward):

o.bind("Control_L", "Wake screensaver (tap Ctrl)", cmd, { non_consuming = true })
o.bind("Control_R", "Wake screensaver (tap Ctrl)", cmd, { non_consuming = true })

Extended the same pattern to Alt_L/R and Super_L/R and all three modifiers wake it reliably now, with no regressions on normal shortcuts.

Not sure if this is Hyprland-version-specific (worth checking on whatever version CI/reviewers are testing against) or a broader regression, but wanted to flag it in case release = true silently doesn't work for others testing this PR too. Happy to share the full local diff if useful.

omarchy-screensaver only exits on a tty byte (read -n1) or signals.
Bare Ctrl never delivers a byte, and idle's handleActiveSignal swallows
compositor activity while the screensaver window is up, so a lone Ctrl
tap did nothing (issue #10583).

While an org.omarchy.screensaver window is open, bind Control_L/R on
press with non_consuming=true to SIGHUP the screensaver process (same
trap exit_screensaver already handles). Bare-modifier binds with
release=true register but never dispatch on Hyprland 0.56.2; press +
non_consuming does. No global mouse wake — that path was removed in
v3.3.0 for Bluetooth mice.

Fixes #10583

Signed-off-by: fresh3nough <anonwurcod@proton.me>
@fresh3nough

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed report — confirmed on Hyprland 0.56.2 (efb50993) here as well: bare-modifier binds with release = true register in hyprctl binds -j but never dispatch, while press-triggered fires.

Switched the screensaver wake binds to press + non_consuming = true (still scoped to open org.omarchy.screensaver windows, still locked = true, still SIGHUP via the existing trap). Kept the change to Control_L/R only for this issue; Alt/Super can be a follow-up if wanted.

bash test/shell.d/screensaver-ctrl-wake-test.sh and bash test/shell.d/system-lock-test.sh both pass.

@fresh3nough
fresh3nough force-pushed the fix/10583-screensaver-ctrl-wake branch from 01e10e4 to f124fb4 Compare September 7, 2026 11:18
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at f124fb4 against quattro. Nothing was run on a worker, because there is a competing fix that I think should carry this instead. Here is the reasoning, so the maintainer can weigh it.

The bug is real. bin/omarchy-screensaver only exits on a byte read from its own stdin or on focus loss, and a bare Ctrl tap produces neither. #7762 tracks the wider form of this problem: pointer, click and touch input don't dismiss the screensaver either.

Competing fix: #7528. It arms a second IdleMonitor (ext-idle-notify) while a screensaver window is on screen, and dismisses on the next seat input. Hyprland reports keyboard and modifier events to idle-notify whether or not they produce a terminal byte, so that one path covers a bare Ctrl press as well as pointer, click, touch and bluetooth mice. It is already verified on a worker. #8048 re-arms terminal mouse reporting instead, which covers no modifier keys. I asked the second opinion which of the three is the best fix without giving it my answer, and it independently chose #7528 for the same reason.

On this pull request as it stands, three things a maintainer would need to know if it went ahead anyway:

  • The wake command signals the terminal emulator, not the script. pkill -HUP -f '[o]rg.omarchy.screensaver' matches command lines containing the class string. bin/omarchy-launch-screensaver:57-66 passes that string to the terminal (alacritty --class=…, foot --app-id=…, and so on), while the script's own command line is bash …/omarchy-screensaver. So the SIGHUP trap at bin/omarchy-screensaver:20 is reached only indirectly, if the terminal exits on SIGHUP and hangs up the pty. Whether it does depends on the terminal. The comments in utilities.lua and the test describe a direct hit on the trap, which is not what happens.
  • It binds on press, so pressing Ctrl to start any Ctrl combination also dismisses the screensaver. That may be intended, but it is a change in behaviour beyond a lone tap.
  • The branch no longer merges into quattro: default/hypr/bindings/utilities.lua conflicts with later changes to the bindings below the inserted block.

There is one more overlap: #6813 reworks screensaver teardown so it no longer uses pkill-by-class patterns like this one.

Second opinion: Codex Medium, which reviewed all three pull requests, read-only. Its choice of #7528 matches mine. Its independence from my reasoning is not guaranteed. On its own it added the point about Ctrl combinations, and it traced the bare-Ctrl coverage to Hyprland's input manager calling idle-notify for modifier changes.

This is now waiting on the maintainer to choose between #7528 and this pull request. Nothing is needed from you unless they ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screensaver doesn't wake on bare Ctrl tap or mouse click (only real keystrokes)

3 participants