Skip to content

Open tray menus on left-click when a menu is exposed - #10383

Closed
crwirth wants to merge 2 commits into
omacom:quattrofrom
crwirth:fix/tray-left-click-opens-menu
Closed

crwirth wants to merge 2 commits into
omacom:quattrofrom
crwirth:fix/tray-left-click-opens-menu

Conversation

@crwirth

@crwirth crwirth commented Sep 5, 2026

Copy link
Copy Markdown

Summary

Fixes #10339.

Left-click on menu-bearing tray icons only opened the menu when SNI ItemIsMenu was set. libayatana-appindicator never sets that property and implements Activate as a silent no-op, so left-click on those icons did nothing even though a working menu was on the bus.

TrayModel.leftClickOpensMenu now opens the menu when onlyMenu, hasMenu, or a menu handle is present. Items with no menu still call activate().

Test plan

  • bash test/shell.d/tray-test.sh — covers ItemIsMenu, hasMenu-without-ItemIsMenu, menu handle, activate-only, and null item
  • Before/after decision matrix against the issue's AppIndicator probe shape (onlyMenu=false, hasMenu=true): old path returns false, new path returns true
  • Activate-only items still take the activate path

Notes

Right-click and middle-click are unchanged. Omarchy's own bar widgets are not SNI items and never reach this branch.

AppIndicator applets never set ItemIsMenu and implement Activate as a
no-op, so left-click on those tray icons did nothing. Prefer the menu
whenever the item exposes one; Activate remains for menu-less items.

Fixes #10339

Signed-off-by: fresh3nough <anonwurcod@proton.me>
@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review labels Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at a41ee1e against quattro (821ae58), on a disposable Omarchy VM running the shell from this branch, with real left-clicks on two tray items: the AppIndicator probe from #10339, and a minimal StatusNotifierItem shaped like a Qt app (ItemIsMenu=false, a menu, and a working Activate). D-Bus calls were recorded with dbus-monitor.

Left-click on quattro this branch this branch with the commit reverted
AppIndicator item (Activate has no handler) Activate called, nothing happens menu opens Activate called, nothing happens
Item with a menu and a working Activate Activate called, the app acts menu opens, Activate never called Activate called, the app acts

So the reported bug is real and this fixes it. test/shell.d/tray-test.sh passes (14/14) and ./test/cli is green on the VM.

The second row is the problem. hasMenu only says an item has a context menu, not that its Activate is dead, and most tray apps have both. Qt's tray backend exports ItemIsMenu=false and delivers Activate as the icon's click, so for apps like KeePassXC (show/hide/raise the window) or qBittorrent (toggle the window), left-click would stop doing what the app wired it to do and open the menu instead. Quickshell 0.3.1 gives QML no way to tell the two apart: activate() returns nothing and only logs a failed call, and a missing ItemIsMenu reads the same as false. Making left-click open the menu for every item that has one is a product decision rather than a bug fix, so this waits on the maintainer to choose between that and a narrower approach (for example, a list of known AppIndicator IDs).

A smaller note on the test: { hasMenu: false, menu: { path: '/Menu' } } is not a shape Quickshell produces, since both come from the same menu path, so the item.menu check adds nothing over item.hasMenu.

Second opinion: Codex Medium reviewed the diff. It agreed the bug is real and fixed (its agreement is not guaranteed independent), and contributed the Qt adaptor's handling of Activate, the KeePassXC and qBittorrent cases, and the test-fixture note above.

Both sides appended assertions to test/shell.d/tray-test.sh; keep quattro's superwhisper and tray-section cases and this branch's left-click cases.

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

Copy link
Copy Markdown
Collaborator

This branch stopped merging after quattro gained #15281 (bar widgets in the tray's drawer), which also appends to test/shell.d/tray-test.sh. I pushed dcae105, a merge of quattro (492b883) into the branch. The only conflict was that test file, and it keeps both sets of assertions. Against quattro, the branch's diff is unchanged: the same three files, +26/−2. #15281 adds no other left-click path for tray items, so Tray.qml's handler is still the only place the change is needed.

Re-checked at dcae105 on a disposable Omarchy VM running the shell from each tree, with real left-clicks on two probe tray items (ItemIsMenu=false, both with a menu: one whose Activate has no handler, like libayatana-appindicator, and one with a working Activate):

Left-click on quattro this branch this branch with a41ee1e reverted
AppIndicator-style item Activate called, nothing happens menu opens Activate called, nothing happens
Item with a working Activate Activate called menu opens, Activate never called Activate called

test/shell.d/tray-test.sh passes 17/17 (including the three new assertions from quattro), and ./test/cli is green on the VM. With the fix reverted, the test fails because leftClickOpensMenu no longer exists.

My earlier finding still stands: left-click now opens the menu for every tray app that has one, which takes the click away from Qt apps that use Activate (KeePassXC, qBittorrent). Choosing between that and a narrower approach is a product decision, so this is waiting on the maintainer.

No second opinion this time: the configured reviewer (Codex Medium) was out of reviews for the day. Only I (Claude Opus 5.5) checked the merge, by comparing it with both parents. Because of that, it does not get the verified label for this revision until a second opinion reviews it.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Changes left-click behavior for system tray icons.

The PR appears safe to merge, with a non-blocking improvement to the hasMenu test.

Findings

  1. P2 `hasMenu` goes untested alone ▶

Summary

Left-click now opens tray menus when onlyMenu, hasMenu, or menu is present.

  • Tray icons open exposed menus on left-click.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Left-click tray icon] --> B{onlyMenu, hasMenu, or menu?}
  B -->|Yes| C[Existing menu-opening path]
  B -->|No| D[activate]
Loading

Reviews (1) · Last reviewed commit: "Merge quattro into fix/tray-left-click-o..." · Reviewed by Greptile

Comment thread test/shell.d/tray-test.sh
// Left-click: menu-only and AppIndicator items with a menu open the menu;
// items that only implement Activate still activate.
assert(tray.leftClickOpensMenu({ onlyMenu: true, hasMenu: false, menu: null }), 'tray opens menu when ItemIsMenu is set')
assert(tray.leftClickOpensMenu({ onlyMenu: false, hasMenu: true, menu: {} }), 'tray opens menu when hasMenu is set without ItemIsMenu')

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 hasMenu goes untested alone

This test also supplies a truthy menu, so it still passes if the hasMenu check is removed. Set menu: null here to test the hasMenu branch on its own. Keep the separate menu-handle case.

Suggested change
assert(tray.leftClickOpensMenu({ onlyMenu: false, hasMenu: true, menu: {} }), 'tray opens menu when hasMenu is set without ItemIsMenu')
assert(tray.leftClickOpensMenu({ onlyMenu: false, hasMenu: true, menu: null }), 'tray opens menu when hasMenu is set without ItemIsMenu')

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 removed the bug Something isn't working label Oct 13, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Classified again at dcae105, because the head moved with the merge of quattro. I (Claude Opus 5.5) read it as a bug: AppIndicator icons from #10339 do nothing on left-click on quattro, and this makes them work. The configured reviewer (Codex Medium), asked separately without my answer, read it as an enhancement, because it also changes, on purpose, what left-click does for every tray app that has a menu and a working Activate. That is the same product question my earlier comment left with the maintainer. With the two readings apart, I took the bug label off. Nothing about the code changed since the last comment, so the results there still hold: on a VM, left-click opens the menu, test/shell.d/tray-test.sh passes 17/17, and ./test/cli is green.

I checked Greptile's note on test/shell.d/tray-test.sh:33 against the source, and it holds. The hasMenu case passes menu: {}, which is truthy, so that assertion would still pass with the hasMenu check removed. Changing it to menu: null makes it test hasMenu on its own. I have not pushed that, because the approach itself is still waiting on a decision.

This waits on the maintainer: to settle what it is, and whether left-click should open the menu for every item that has one or only for AppIndicator items.

@crwirth crwirth closed this Oct 29, 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.

Left-click does nothing on menu-only tray items: omarchy.tray calls activate() unless ItemIsMenu is set

2 participants