Skip to content

Fix context menus for Wine tray items - #9245

Closed
clementrog wants to merge 6 commits into
omacom:quattrofrom
clementrog:fix/wine-tray-context-menu
Closed

clementrog wants to merge 6 commits into
omacom:quattrofrom
clementrog:fix/wine-tray-context-menu

Conversation

@clementrog

@clementrog clementrog commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Route Wine status notifier items to their native ContextMenu method instead of trying to render /NO_DBUSMENU as a DBusMenu
  • Resolve the current item through StatusNotifierWatcher, verify both its Wine id and /NO_DBUSMENU sentinel, then forward the click's screen coordinates
  • Leave regular DBusMenu tray items on the existing path
  • Cover Wine detection plus malformed arguments, stale ids, real DBus menus, and the exact native call coordinates

Why

Battle.net running through GE-Proton registers a live status notifier item like this:

Id:   wine-0x200d4-0
Menu: /NO_DBUSMENU

The current tray treats that sentinel as a real DBusMenu object. Right-clicking therefore logs DBus UnknownMethod errors and renders nothing, which also makes Battle.net's Exit action inaccessible.

The freedesktop Status Notifier Item specification defines ContextMenu(INT x, INT y) for exactly this right-click fallback, with coordinates in screen space.

Verification

  • bash test/shell.d/tray-test.sh
  • bash test/shell.d/tray-context-menu-test.sh
  • ./test/cli
  • ./test/all: both new tray test files pass in the full run. Seven unrelated host-environment checks initially failed; each was rerun successfully with its expected companion checkout or host access. The URL-checker absence case also passes with an isolated PATH, because this Omarchy machine already has the checker installed globally.
  • Live Battle.net item: confirmed wine-0x200d4-0 and /NO_DBUSMENU, ran the exact helper from this branch, and visually confirmed the native menu opens with its Exit action

The branch is rebased onto current quattro.

Fixes #15057

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at ab1a35e against quattro (432b5e3). The bug is real and this fixes it.

Reproduced on an Omarchy worker VM (Quickshell 0.3.1, the version Omarchy ships), using a stand-in tray item with Id wine-0x200d4-0, Menu /NO_DBUSMENU and a ContextMenu(ii) method, right-clicked with real input:

  • On quattro, the shell calls GetLayout on /NO_DBUSMENU, logs UnknownMethod, opens an empty menu frame, and ContextMenu is never called.
  • On this branch, ContextMenu(1177, 12) reaches the item, with no DBus errors and no empty menu.

Upstream Quickshell has since stopped treating /NO_DBUSMENU as a menu (commit 39e14d3, not yet released), but even then it never calls ContextMenu, so this branch is still needed after that lands. ./test/cli, tray-test.sh, tray-context-menu-test.sh, bar-test.sh, bar-widget-contract-test.sh, qml-text-format-test.sh, bin-style-test.sh and panel-command-path-test.sh all pass on the worker. The change is proportionate: Quickshell doesn't expose the item's bus name, so a helper that looks it up through the watcher is the smallest way to make the call.

One thing to know about, not a blocker: the coordinates are layout coordinates, but Wine reads them as X11 screen coordinates, and Omarchy sets xwayland:force_zero_scaling. With a second monitor at scale 2 attached, the shell passed 2138, 12 for a click there, and an X11 popup placed at X 2138 landed 429 px to the left. One placed at X 1177 (the click on the scale-1 primary monitor) landed on the other monitor. On a single scale-1 monitor the two coordinate spaces match. I couldn't run real Wine on the worker, so whether Battle.net places its menu from these coordinates or from the cursor position is unconfirmed.

The second opinion (Codex Medium) did not run: the reviewer's daily quota was spent. This was reviewed by Claude Opus 5.5 alone. It is labelled verified, not ready, and waits on that second review before going to the maintainer.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 13, 2026
TrayModel.js conflicted where quattro added widgetsForTrayItems beside usesNativeContextMenu; both are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch had stopped merging cleanly into quattro, so I merged quattro into it (e33e8fb). The only conflict was in shell/plugins/bar/widgets/TrayModel.js, where quattro had added widgetsForTrayItems right beside usesNativeContextMenu. I kept both, and your commit is unchanged.

Re-checked at e33e8fb on an Omarchy worker VM (Quickshell 0.3.1), using the same stand-in tray item as before (Id wine-0x200d4-0, Menu /NO_DBUSMENU), right-clicked with real input:

  • On quattro (492b883), and on this head with the Tray.qml change reverted, the shell calls GetLayout on /NO_DBUSMENU, logs UnknownMethod, and never calls ContextMenu.
  • On this head, ContextMenu(1150, 12) reaches the item and nothing is sent to /NO_DBUSMENU.

./test/cli passes on the worker, and so do tray-test.sh, tray-context-menu-test.sh, tray-menu-test.sh, bar-test.sh, bar-widget-contract-test.sh, qml-text-format-test.sh, bin-style-test.sh and panel-command-path-test.sh. My earlier note about coordinates on scaled monitors still stands, and nothing else came up.

This fixes #15057, which reports the same Battle.net symptom. I couldn't link the two yet because the item's classification has to be confirmed again at the new head first.

The second opinion (Codex Medium) didn't run again this time: today's review quota was spent before this pull request came up. Claude Opus 5.5 reviewed it alone, so it isn't labelled verified or ready yet. It's waiting on that second review, and then it goes to the maintainer.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain in the reviewed changes.

Summary

Adds a native context-menu path for tray items without a D-Bus menu.

  • Tray clicks now open native menus for items without D-Bus menus.

No new actionable issues were found. Runtime tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Tray menu requested] --> B{Item has a menu?}
  B -->|Yes| C[Existing tray popup]
  B -->|No| D[Native menu helper]
  D --> E[Find registered items with matching ID]
  E --> F{Exactly one match without a real menu?}
  F -->|Yes| G[Call ContextMenu with screen coordinates]
  F -->|No| H[Exit without opening a menu]
Loading

Reviews (4) · Last reviewed commit: "Route tray items to their own menu on a ..." · Reviewed by Greptile

Comment thread test/shell.d/tray-context-menu-test.sh Resolved
@lkshrk

lkshrk commented Oct 26, 2026

Copy link
Copy Markdown

Tested the same approach locally on quickshell 0.3.2 (a cloned tray calling ContextMenu at the cursor through the watcher): it opens Battle.net's menu. As noted in #15057, the menu window shares the launcher's class and title, so battlenet.lua's size rule and any per-class workspace rule catch it too. Here it opened on the launcher's workspace and switched there until I added a short-lived rule while the menu is expected.

@omarchybot omarchybot added the bug Something isn't working label Nov 3, 2026
omarchybot and others added 2 commits November 3, 2026 04:03
Quickshell 0.3.2 hands an item whose Menu is /NO_DBUSMENU over with no menu at all, and display() then only logs "No menu present", so routing on the wine- id alone leaves every other menu-less item with a dead right-click. Route on a missing menu as well, keeping the wine- match for 0.3.1, which still treats the sentinel as a menu.

The helper now reads each item's properties in one call with a 1-second timeout, so an app that stops answering cannot stall the lookup, and refuses to choose when several registered items share the id: Quickshell gives no bus address, so picking one could open another instance's menu. It resolves through OMARCHY_PATH rather than the bar, so the Tray widget works without one.

The end-to-end test drives the real Tray widget against a mock item with no D-Bus menu and checks its ContextMenu is called, then adds a twin and checks the helper opens neither.

Co-Authored-By: lkshrk <5067446+lkshrk@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 3, 2026
Comment thread test/shell.d/tray-context-menu-test.sh Resolved
omarchybot and others added 2 commits November 3, 2026 04:15
Omarchy's AGENTS.md asks for the area's existing test file to be extended rather than a new one added. The twin-item case is left to tray-menu-test.sh, which checks it against real registered items.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Omarchy's quickshell package is 0.3.2, which reports Wine's /NO_DBUSMENU as no menu, and the shell only reaches users together with it. Matching wine- ids as well served only 0.3.1, and sent a wine- item that does publish a D-Bus menu to the helper, which refuses it, instead of to the tray's own popup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

I brought this up to date with quattro and folded in what #17057 added, so it now covers every tray item without a D-Bus menu, not only Wine's. #17057 fixes the same bug (#15057) and was opened later, so this one goes forward, with @lkshrk credited as co-author on the commit that carries their work.

What changed on your branch (fce0275, 09fa90c, 7b46ac2, d7b3024):

  • Merged quattro (ae64a4b) in; it merged without conflicts.
  • usesNativeContextMenu now routes on a missing menu alone. Omarchy's quickshell package is 0.3.2, which reports /NO_DBUSMENU as no menu, so the wine- id check served only 0.3.1. It also sent a wine- item that does publish a D-Bus menu to the helper, which refuses it, instead of to the tray's own popup. The item.display() fallback is gone: on 0.3.2 it only logs No menu present.
  • bin/omarchy-tray-context-menu reads each item's properties in one call with a 1-second timeout, so an app that stops answering can't stall the lookup. It also refuses to choose when several registered items share the id, because Quickshell gives no bus address to tell them apart. It accepts an empty Menu, /, or /NO_DBUSMENU, and is started through OMARCHY_PATH rather than the bar.
  • tray-menu-test.sh now drives the real Tray widget against a mock item with no D-Bus menu and checks that its ContextMenu is called. A second mock with the same id then checks that the helper opens neither. The helper's stubbed checks moved from tray-context-menu-test.sh into tray-test.sh, since Omarchy's AGENTS.md asks for the existing test file to be extended. They include separate invalid-x and invalid-y cases, as Greptile suggested. The Verification list in the description still names the old file.

Checked on an Omarchy worker VM (Quickshell 0.3.2): the new end-to-end test fails on quattro, and on this head with the Tray.qml and TrayModel.js changes reverted, with the shell logging No menu present. It passes at d7b3024. ./test/cli, tray-test.sh, tray-menu-test.sh, tray-symbolic-icon-test.sh, bar-test.sh, bar-widget-contract-test.sh, qml-text-format-test.sh, bin-style-test.sh and panel-command-path-test.sh pass there. The worker has no Wine and no pointer-input tool, so neither Battle.net nor a real mouse click was run this time. The click handler that leads into openTrayMenu is unchanged from the 2026-10-13 run, which right-clicked a stand-in item with real input.

Second opinion: Codex Medium reviewed every round and found no defects. muse-wonder (pi, thinking high) reviewed the last two rounds and found none either. They read the same tree I did, so their agreement isn't guaranteed to be independent.

Two questions are still open, both for the maintainer rather than for you. The coordinates are layout coordinates, without the devicePixelRatio scaling the workaround in #15057 applies, so on a mixed-scale multi-monitor setup Wine's menu can land away from the icon, as noted earlier. The Battle.net window rule catching Wine's menu window, which @lkshrk saw, is a separate problem and isn't touched here. This is labelled verified and now waits on the maintainer.

ryanrhughes added a commit that referenced this pull request Nov 12, 2026
Wine builds tray Ids from window handles, so apps in two prefixes can
collide, and Quickshell gives no bus name to tell them apart. Picking the
first match could open the other app's menu, so refuse instead.

From #9245's helper, by @clementrog.
@ryanrhughes

Copy link
Copy Markdown
Collaborator

Thanks @clementrog! Your right-click fix shipped in #18597, along with the double-click fix and a change to the Battle.net window rule. The duplicate-Id guard came straight from this PR, and you're credited as a co-author on the merge commit.

Closing this one since #18597 covers it.

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

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tray: right-click on Wine apps (Battle.net) shows empty menu / nothing — needs quickshell 0.3.2 + ContextMenu fallback

4 participants