Skip to content

Dismiss the menu when clicking on another monitor - #78

Merged
dl-chief-agent[bot] merged 1 commit into
DanielLemky:masterfrom
EttienneM:fix/dismiss-on-other-monitor
Sep 13, 2026
Merged

dl-chief-agent[bot] merged 1 commit into
DanielLemky:masterfrom
EttienneM:fix/dismiss-on-other-monitor

Conversation

@EttienneM

Copy link
Copy Markdown
Contributor

Problem

On a multi-monitor setup, clicking away to dismiss the menu only works if you click on the monitor the menu opened on. Clicking anywhere on any other monitor does nothing and the menu stays open.

Cause

The menu's PanelWindow requests exclusive keyboard focus:

WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive

That makes Hyprland hold a seat grab for that surface. Pointer events outside the grabbing surface's geometry are discarded rather than routed onward, and a layer surface lives on exactly one output — so every click on any other monitor is dropped before anything can react to it.

This also explains why the existing scrim MouseArea works on the opening monitor: that click lands inside the grabbing surface.

The symptom is invisible on a single-monitor setup, where the grabbing surface covers the whole screen.

Fix

Use OnDemand keyboard focus and dismiss via HyprlandFocusGrab, which is how Omarchy's own Ui/PopupCard.qml handles outside-click dismissal. The grab applies compositor-wide, so a click on any monitor clears it.

HyprlandFocusGrab {
  active: panel.visible
  windows: [panel]
  onCleared: root.cancel()
}

Verification

Tested on Hyprland with two monitors (eDP-1 + HDMI-A-1, both scale 2), Quickshell 0.3.1, Omarchy dev:

  • Clicking on the other monitor now dismisses the menu. Clicking the scrim on the opening monitor still dismisses as before.
  • Keyboard input still reaches the menu without exclusive focus — sent keystrokes with wtype and confirmed filterText tracked t → te → ter → term.
  • Repo test suite passes (tests/manifest-test.sh plus every tests/*-test.js, including opening-screen-test.js).

An intermediate attempt that added a catch-all surface on each other monitor is worth recording as evidence: that surface rendered and dimmed correctly but received zero pointer events, not even motion. A surface that paints yet gets no motion rules out input-region problems and points squarely at the seat grab.

Caveat worth your judgement

Exclusive may have been deliberate, to guarantee the menu takes keyboard focus. With OnDemand the focus grab is what delivers it. I verified typing when opening over a normal window, but I did not test opening over a fullscreen window, or while another exclusive layer surface (lock screen, another launcher) holds focus. If OnDemand proves too weak there, the alternative is to keep Exclusive and give the menu a surface per monitor — heavier, but no change to the focus model.

🤖 Generated with Claude Code

The menu's layer surface requested exclusive keyboard focus, which makes
Hyprland hold a seat grab for that surface. Pointer events outside its
geometry are then discarded rather than routed onward, and since a layer
surface lives on a single output, every click on any other monitor was
dropped -- leaving the menu open. Clicking the scrim on the opening monitor
worked because that click lands inside the grabbing surface.

Switch to OnDemand keyboard focus and dismiss via HyprlandFocusGrab, matching
how Omarchy's own Ui/PopupCard handles outside-click dismissal. The grab
applies compositor-wide, so clicking away works from any monitor.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dl-chief-agent
dl-chief-agent Bot merged commit 0ef38ee into DanielLemky:master Sep 13, 2026
1 check passed
@dl-chief-agent dl-chief-agent Bot mentioned this pull request Sep 13, 2026
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