Skip to content

Dismiss active screensaver when opening application launcher (#16258) - #16420

Open
hari45wavin wants to merge 2 commits into
omacom:quattrofrom
hari45wavin:fix/16258-dismiss-screensaver-on-launcher-open
Open

hari45wavin wants to merge 2 commits into
omacom:quattrofrom
hari45wavin:fix/16258-dismiss-screensaver-on-launcher-open

Conversation

@hari45wavin

Copy link
Copy Markdown

Fixes #16258

Problem

When the screensaver is running on its special workspace and a user presses Super+Space (or any shortcut that summons the application launcher or menu), the global shortcut is consumed by Hyprland and triggers the Quickshell overlay menu. Because Quickshell menus and panels are Wayland layer-shell surfaces rather than regular client windows, Hyprland's activewindow does not change to another regular window. The screensaver process (bin/omarchy-screensaver) therefore continues running in the background behind the launcher overlay, rather than dismissing upon user interaction.

Solution

  1. Idle Service (shell/plugins/services/idle/Service.qml): Added dismissScreensaver(reason) method that checks if the screensaver is active/running, sends SIGTERM (pkill -f [o]rg.omarchy.screensaver), and cancels the idle cycle (cancelIdleCycle("screensaver-dismissed")). Exposed this on ShellIpc.
  2. Shell Root (shell/shell.qml): Added shell.dismissScreensaver() which invokes the idle service method (or falls back to pkill), and called it in summon() and runShortcut() whenever an interactive overlay or shortcut is activated.
  3. Menu CLI (bin/omarchy-menu): Explicitly issues pkill -f '[o]rg.omarchy.screensaver' before invoking toggle or summon commands to ensure screensaver termination even if summoned directly via CLI.
  4. Test Suite: Added test assertions to test/shell.d/idle-test.sh verifying screensaver dismissal logic in Service.qml and shell.qml.

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects screensaver dismissal across desktop shell interactions.

The PR still needs a fix for screensaver launches that can finish after dismissal.

Findings

  1. P1 Screensaver returns after dismissal ▶
  2. P2 Tests miss broken dismissal ▶

Summary

This PR dismisses the screensaver when the user opens the launcher or another shell surface.

  • Opening a shell menu or shortcut dismisses an active screensaver.
  • The menu command stops the screensaver before opening a menu.

Diagram

sequenceDiagram
  participant User
  participant Shell
  participant Idle
  participant Processes
  User->>Shell: Open launcher or popup
  Shell->>Idle: dismissScreensaver()
  Idle->>Processes: Start helper and terminal kill commands
  Idle->>Idle: Cancel idle timers
  Shell->>Shell: Open requested surface
Loading

Reviews (2) · Last reviewed commit: "fix(shell): terminate screensaver launch..." · Reviewed by Greptile

Comment on lines +161 to +162
Util.execArgv(["pkill", "-f", "[o]rg.omarchy.screensaver"])
root.cancelIdleCycle("screensaver-dismissed")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Screensaver returns after dismissal

If the user opens the launcher while omarchy-launch-screensaver is still starting terminals, pkill only kills terminals that already exist. The launch helper does not match that pattern and can start another terminal afterward. cancelIdleCycle() stops timers but leaves the helper running, so a screensaver window can appear after dismissal. Cancel pending launches as well as existing screensaver windows.

Comment thread shell/shell.qml Resolved
Comment thread test/shell.d/idle-test.sh
Comment on lines +58 to +63
assert(
/function dismissScreensaver\(/.test(serviceSource) &&
/pkill[\s\S]*?screensaver/.test(serviceSource) &&
/cancelIdleCycle\("screensaver-dismissed"\)/.test(serviceSource),
'idle service dismisses screensaver and cancels idle cycle'
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tests miss broken dismissal

These new tests only search for implementation text. AGENTS.md explicitly says, “Don't restate the implementation: grepping the source or config for the string you just added.” They never call dismissal or check that the screensaver stops. The summon expression also passes when an earlier return skips dismissal.

Replace these checks with a test that exercises the real dismissal path and checks its effects. This repository requirement must be satisfied before merging.

File Used: AGENTS.md (source)

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!

@omarchybot omarchybot added the bug Something isn't working label Oct 23, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I read this against quattro at 967bbdd together with the other open pull requests that fix #16258, and had Codex Medium review all of them. Nothing was run on a worker. This one fixes the reproduction: Super+Space and the power key reach the shell through runShortcut, and dismissing there gets around the screensaver's tty and focus checks. Reading the code, three things are wrong with it as it stands:

  • omarchy-launch-screensaver opens one terminal per monitor and waits for each window before moving to the next (bin/omarchy-launch-screensaver:53-74). Its own command line does not match [o]rg.omarchy.screensaver, so the pkill in dismissScreensaver does not stop it. If the menu opens while it is still going through the monitors, the remaining screensavers open behind the menu after the dismissal.
  • summon returns early for bar-widget panels (shell/shell.qml:1190-1194), before the new shell.dismissScreensaver() call. So omarchy-shell shell summon for a bar popup, such as audio or network, still leaves the screensaver up behind it. Shortcuts are only covered because runShortcut dismisses first.
  • The new assertions in test/shell.d/idle-test.sh only search the source for the lines this change adds, which Omarchy's AGENTS.md asks tests not to do. The summon regex passes even with the early return above.

Two other open pull requests fix the same bug in different ways. #11746 dismisses the screensaver on any seat input the compositor sees. #16235 makes the terminal report modifier keys. #11746 is the oldest. Under our default, the first fix to arrive keeps the credit unless a later one is clearly better, and the defects above mean this one is not. Codex reached the same conclusion on its own, though its independence from my reasoning is not guaranteed. One case this approach does handle that #11746 does not: a press during #11746's settle window just after the screensaver launches. That only counts if dismissal also stops the launch in progress.

This now waits on the maintainer, who decides which approach to take for #16258. I have not labelled it beyond bug, and no changes were pushed.

@hari45wavin

Copy link
Copy Markdown
Author

Thanks for the thorough review! Updated with the following improvements:

  1. Targeted both omarchy-launch-screensaver and org.omarchy.screensaver during dismissal to prevent delayed screensaver terminals from spawning if a launch was in progress.
  2. Moved shell.dismissScreensaver() to the very start of summon() in shell/shell.qml before summonBarWidget() to ensure all menu/bar widget activations consistently dismiss the screensaver.
  3. Enhanced test coverage in test/shell.d/idle-test.sh to verify dismissal behavior.

@omarchybot

Copy link
Copy Markdown
Collaborator

I read 2ff0b23 against quattro at 967bbdd, again alongside #11746 and #16235, and had Codex Medium review all three. Nothing was run on a worker. Moving shell.dismissScreensaver() to the top of summon fixes the bar-widget gap: omarchy-shell shell summon for audio, network and the other bar popups now dismisses the screensaver too. Two things are still wrong:

  • pkill -f '[o]marchy-launch-screensaver' matches more than the launch loop. omarchy-launch-screensaver leaves a background subshell running after it returns (bin/omarchy-launch-screensaver:81-86), and that subshell keeps the script's command line, so this pattern kills it. That subshell is what gives focus back to the original monitor once the screensavers close, which is why the class goes through the environment rather than argv (line 80). With it killed, a multi-monitor desktop is left focused on whichever monitor's screensaver workspace emptied last. I checked the matching with a small script of the same shape: the backgrounded subshell shows up as bash <script> and the pattern kills it. Codex, asked what each pattern matches, reached the same answer, though its independence from my reasoning is not guaranteed.
  • A terminal can still appear after dismissal. hypr_exec hands the launch to Hyprland asynchronously (line 32), so a terminal Hyprland has accepted but not yet started is missed by both pkills, which Util.execArgv runs detached and in no particular order.

The new shouldDismissScreensaver and omarchy-menu tests run real code. The summon and runShortcut assertions still only search the source for the lines this change adds, which Omarchy's AGENTS.md asks tests not to do, and nothing tests what the pkill patterns actually match.

On the competing fixes, nothing has changed: #11746 is the oldest, and neither Codex nor I found a defect in how it handles this reproduction that would make this one clearly better. The one case this one handles that #11746 does not, a press in the moments right after the screensaver starts, needs the launch to be stopped, and stopping it this way costs the focus handoff. This waits on the maintainer to choose an approach for #16258. It stays labelled bug only, and no changes were pushed.

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.

Super+Space opens the application launcher over the active screensaver without dismissing it

2 participants