feat(tray): use ksni on Linux for working left-click toggle (#310)
Tauri's default tray uses libayatana-appindicator, which by design does not dispatch primary-click events to its client — libayatana delegates every left-click to the libdbusmenu-managed menu. The existing show_menu_on_left_click(false) setting and TrayIconEvent::Click handler never fire on Linux. Confirmed present in tray-icon 0.21.x and 0.22.0 (the newest release). Switch the Linux backend to ksni, a pure-Rust StatusNotifierItem implementation that exposes the full SNI protocol including Activate (left-click), SecondaryActivate (middle), and ContextMenu. Same SNI compatibility as the previous backend — works wherever the panel already handled our tray (KDE, GNOME+AppIndicator, XFCE/Cinnamon/MATE, wlroots trays). Flatpak just needs the --talk-name=org.kde. StatusNotifierWatcher permission which is already in our manifest. Tauri's tray stays on macOS (no Windows client is shipped). The dispatch lives in tray.rs behind cfg(target_os); Linux delegates to the new tray_linux_ksni module. Playback-control menu events (tray:play_pause, tray:next, tray:previous) still emit into the main webview window, so frontend handlers keep working unchanged. cc
This commit is contained in:
5 files changed
+260
-12
No files matched your search
@@ -157,6 +157,11 @@ futures-util = "0.3"
|
||||
tauri-plugin-dialog = { version = "2.7.0" }
|
||||
ashpd = { version = "0.13", default-features = false, features = ["tokio", "notification", "inhibit", "secret"] }
|
||||
mupdf = { version = "0.6", features = ["sys-lib-zlib", "sys-lib-harfbuzz", "sys-lib-freetype"] }
|
||||
# Linux tray via StatusNotifierItem with primary-activate support.
|
||||
# Tauri's built-in tray uses libayatana-appindicator which does not dispatch
|
||||
# left-click events to clients (by design — primary click always shows the
|
||||
# menu). ksni is a pure-Rust SNI impl that exposes Activate. See issue #310.
|
||||
ksni = { version = "0.3", features = ["blocking"] }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
tauri-plugin-dialog = { version = "2.7.0" }
|
||||
|
||||
Reference in new issue
Block a user