omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Tray context menu does not dismiss from its trigger or elsewhere on the bar

Open SmithLabsLLC opened this issue 3 months ago • 1 comments

System details

Intel Core i5-1235U / Intel Iris Xe, Omarchy 4.0.1-1, Hyprland 0.56.2-1, Quickshell 0.3.1-1, kernel 7.1.9-arch1-2

What's wrong?

The system-tray context menu opens on right-click, but a second right-click on the same tray item leaves the menu open. Opening the menu and then clicking elsewhere on the Omarchy bar also leaves it open.

This is separate from #8111. That issue concerns clicks being rejected before a tray action can run; this report concerns dismissal after a menu is already open.

Steps to reproduce

  1. Start any application that exposes a healthy StatusNotifierItem menu.
  2. Right-click its icon in the Omarchy system tray.
  3. Right-click the same tray icon again.
  4. Open the menu again, then left-click another location on the top bar.

Actual behavior

  • The second right-click leaves the same menu open.
  • Clicking elsewhere on the bar leaves the menu open.

Expected behavior

  • Repeating the trigger on the same tray item closes its open menu.
  • Clicking outside the popup, including elsewhere on the bar, dismisses it.

Source-level cause

There are two independent paths:

  1. shell/plugins/bar/widgets/Tray.qml's openTrayMenu() always assigns trayMenuOpen = true; it does not detect that the same item's menu is already open and toggle it closed.
  2. shell/Ui/PopupCard.qml includes both the popup and the complete anchor window in HyprlandFocusGrab.windows. For a tray popup the anchor window is the entire bar, so a click elsewhere on that bar remains inside the focus grab and cannot dismiss the popup.

Fix direction and validation

A focused local patch adds an includeAnchorWindowInFocusGrab opt-out that defaults to true, disables it only for tray popups, and explicitly toggles the same open tray item closed. Existing PopupCard consumers retain their current behavior. Submenu handling and menu-entry activation are unchanged.

The patch applies cleanly to Omarchy commit 56fbaf4689e3eb6867c0b7f375ae49964f183774, and the supported cloned tray plugin passes omarchy plugin validate with the change. The upstream files affected are:

  • shell/Ui/PopupCard.qml
  • shell/plugins/bar/widgets/Tray.qml

I generated omarchy-debug --no-sudo --print locally, but the full output contains unrelated host and network identifiers, so I am not attaching it. The relevant versions are included above.

SmithLabsLLC avatar Aug 31 '26 04:08 SmithLabsLLC

Both symptoms reproduce on current quattro, on a worker built from the Omarchy ISO with the test suite's mock tray item in the real bar: a second right-click on the item leaves its menu open, and a left-click on empty bar space leaves it open too (the tray drawer then collapses, so the menu hangs under an icon that is no longer shown). A click on the desktop does dismiss it.

The first is fixed in #14708: openTrayMenu() reopened the menu on every click, and now closes it when the click is on the item that owns it, as the tray's manage popup and the media widget already do. On the worker it then opens, closes and reopens on successive right-clicks, and the tray, tray-menu and bar shell tests and ./test/cli pass.

The second is left for the maintainer, because the cause you identified is deliberate: PopupCard keeps the bar in its focus grab so that clicking another bar widget switches popups in one click, and Hyprland does not pass on the click that clears a grab. Taking the bar out of the grab, for all popups or only tray ones as you proposed, would make that first click only dismiss. The alternative is for the bar to close the active popout itself on a click that lands on no widget, which is what KeyboardPanel does for the clock and other panels. Which to do is the maintainer's call.

Reviewed by Claude Opus 5.5, with Codex Medium as a second opinion. Codex agreed the fix is correct, including when switching between tray items, for menu-only items and during the close animation. It independently confirmed from Hyprland's source that the click clearing a grab is not replayed, which is the trade-off above; how independent that review is cannot be guaranteed. Waiting on the maintainer for #14708 and for the choice on empty-bar clicks.

omarchybot avatar Oct 09 '26 10:10 omarchybot