Skip to content

Dismiss open panels and grant focus grace period on screensaver launch - #13475

Open
AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:fix/screensaver-panel-focus-dismiss
Open

AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:fix/screensaver-panel-focus-dismiss

Conversation

@AnPod

@AnPod AnPod commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Summary

When a bar widget's KeyboardPanel (such as the calendar) is open and the idle screensaver launches, the overlay surface holds exclusive/on-demand focus and a full-screen input region. That stops the screensaver window from becoming active, so omarchy-screensaver exited within ~1s believing the user had dismissed it (#13265).

This:

  1. Dismisses all open panels via omarchy-shell shell hideOpenPanels when launching the screensaver.
  2. Grants a 5-second focus grace period in omarchy-screensaver so temporary focus lag after mapping cannot immediately trigger self-dismissal.

Fixes #13265

Testing

  • Added test/shell.d/screensaver-panel-focus-test.sh verifying panel dismissal and focus grace.
  • Ran bash test/shell.d/screensaver-panel-focus-test.sh (all 5 assertions passed).

Co-authored-by: AnPod <AnPod@users.noreply.github.com>
@jandrusk

jandrusk commented Oct 7, 2026

Copy link
Copy Markdown

Thanks for this. A few notes:

@stevennwokocha42-max

Copy link
Copy Markdown

Working implementation across Bar, Shell, and Idle Service

We encountered and verified this issue on Omarchy 4.5.0 (KeyboardPanel retaining exclusive/on-demand focus and remaining drawn over the screensaver until manually dismissed with Esc).

Here is a tested implementation that cleanly resolves both the visual overlay and the input grab across all panel types (both bar-widget popups and overlay panel loaders):

  1. shell/plugins/bar/Bar.qml: Add closeAllPopouts() to dismiss activePopout and close any open widgets in moduleSlots:
  function closeAllPopouts() {
    if (activePopout) {
      if (typeof activePopout.close === "function") activePopout.close()
      activePopout = null
    }
    for (var i = 0; i < moduleSlots.length; i++) {
      var slot = moduleSlots[i]
      if (slot && slot.activeItem && typeof slot.activeItem.close === "function") {
        if (slot.activeItem.opened === true || slot.activeItem.open === true) {
          slot.activeItem.close()
        }
      }
    }
    return true
  }
  1. shell/shell.qml: Add closeAllPanels() and expose it on ShellIpc (target shell):
  function closeAllPanels() {
    if (shell.bar && typeof shell.bar.closeAllPopouts === "function") {
      shell.bar.closeAllPopouts()
    }
    for (var id in panelLoaders) {
      hide(id)
    }
    for (var openId in openPanelIds) {
      hide(openId)
    }
    return true
  }
  1. shell/plugins/services/idle/Service.qml: In launchScreensaver(), dismiss open panels immediately when the idle deadline triggers:
  function launchScreensaver() {
    root.screensaverStartedThisCycle = true
    screensaverLaunchGraceTimer.restart()
    if (shell && typeof shell.closeAllPanels === "function") shell.closeAllPanels()
    runProcess(screensaverProcess, "screensaver", "[[ $(omarchy-shell lock isLocked 2>/dev/null) == \"true\" ]] || omarchy-launch-screensaver")
  }
  1. bin/omarchy-launch-screensaver: Call omarchy-shell -q shell closeAllPanels 2>/dev/null || true before monitor focus and terminal mapping.

Filed by Gemini 3.8 Flash via Antigravity.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screensaver closes after ~1s as a small square when the clock calendar popup is open

5 participants