fix(tray): show the tray icon on Linux by attaching its menu - #329
hiro-nikaitou wants to merge 1 commit into
Conversation
Signed-off-by: hiro-nikaitou <vieteviete@proton.me>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe Linux tray builder now attaches the menu during tray icon creation. The Linux tray event handler remains unchanged. ChangesLinux tray icon
Assessment against linked issues
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable defect is established. The change is mergeable after normal checks, though confirming the tray flow on a Linux appindicator desktop would validate the intended behavior. 🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 Clippy (1.98.0)Clippy execution timed out Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The Windows tray refactor split the builder in two and the Linux branch kept only
the click handler, not the menu.
tray-icon0.21.3 (pinned insrc-tauri/Cargo.lock) documents two Linux facts that make that combinationinvisible:
TrayIconBuilder::menu/TrayIcon::new: "Linux: Sometimes the icon won't bevisible unless a menu is set. Setting an empty
Menuis enough."TrayIconEvent: "Linux: Unsupported. The event is not emmited even though theicon is shown"
So on Linux the indicator was built with no menu at all (
popup_tray_menucouldnever be reached), and hosts such as KDE Plasma never displayed it. With close
hidden to the tray there was then no way back to the window.
The Linux builder now attaches the same menu the other platforms attach; the
appindicator host opens it on click, and Open restores the window.
Verification, on the base revision
ccc1eb8and on the patched tree:cfg(not(any(target_os = "macos", target_os = "windows")))builder and reports whether it attaches a menu:LINUX_MENU_ATTACHED=falseLINUX_MENU_ATTACHED=trueLINUX_MENU_ATTACHED=truecargo fmt --manifest-path src-tauri/Cargo.toml -- --check-> exit 0 (the CIformat:checkstep); it parsestray.rs, so the edit is syntactically validgit diff --numstat->3 1 src-tauri/src/tray.rsNot covered: nothing here compiles or runs the Linux target (libappindicator/GTK
are not available, and the branch is
cfg-excluded on Windows), so the fix restson the crate's documented Linux behaviour plus the 0.6.2-to-0.6.9 regression
rather than on running the app on a Linux desktop.
Left alone: the Linux click handler and
popup_tray_menustay (they are dead onLinux now) to keep this diff minimal; deleting them is an easy follow-up.
Fixes #316