Repository navigation
fix(linux): let the panel open the tray menu - #258
Merged
Merged
Conversation
tray_manager 0.8.0 runs on nativeapi, whose Linux tray is a StatusNotifierItem. There TrayIcon.openContextMenu() always returns false, and with ContextMenuTrigger.none the item exports /NO_DBUSMENU, so no click could ever show the menu. On Linux, use ContextMenuTrigger.clicked so the panel draws the exported dbusmenu, and ignore click events instead of opening the menu from Dart. The dbusmenu opened/closed events still drive the menu-open refresh hold. Fixes YuanDevTeam#257 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JwtuH1tqyDzGFdewtgzKgx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #257: the Linux tray menu no longer opens in 26.11.1.
Cause
tray_manager0.8.0 runs onnativeapi, whose Linux tray is a StatusNotifierItem. The panel draws the menu from the exported dbusmenu.NativeTrayPlatform.initsetContextMenuTrigger.noneand opened the menu itself on click. On Linux:TrayIcon.openContextMenu()always returnsfalse(nativeapi 0.5.2 up to the current core), soopenMenu()throwsUnable to open the tray menu.none, the item exportsMenu = /NO_DBUSMENUandItemIsMenu = false, so the panel has no menu to show. On GNOME a single click doesn't reach the app at all.Change
lib/service/shared/menu/tray/platform.dart, Linux only:ContextMenuTrigger.clicked, so the item exports its dbusmenu withItemIsMenu = trueand the panel opens the menu on a left or right click.onClick(which led toopenMenu()). Some hosts still sendActivate/ContextMenualongside the exported menu. A debug log line records it.Windows and macOS keep
none+openContextMenu().The panel's dbusmenu
opened/closedevents arrive asMenuOpenedEvent/MenuClosedEvent, soonMenuVisibilityand theTrayServicerefresh hold while the menu is open still work. Item clicks arrive asMenuItemClickedEventthrough the same listeners as before.Verification
git diff --checkpasses. I didn't have a Flutter SDK on the test host, soflutter analyze/flutter testwere not run, and I didn't build or run the patched app.libcnativeapi.sofrom the 26.11.1 DEB the same wayNativeTrayPlatformdoes.none(current code):openContextMenu()=false,Menu = /NO_DBUSMENU,ItemIsMenu = false. This matches the installed 26.11.1.clicked(this change):Menu = /StatusNotifierItem/Menu,ItemIsMenu = true,GetLayoutreturns the items. Sending dbusmenuEventopened, thenclickedon an item, thenclosed, deliveredMenuOpenedEvent,MenuItemClickedEventandMenuClosedEventin that order.🤖 Generated with Claude Code
https://claude.ai/code/session_01JwtuH1tqyDzGFdewtgzKgx