From 46355120e99f306d2411b6cc8a4e9bf873f31e2a Mon Sep 17 00:00:00 2001 From: Reactor Scram Date: Tue, 25 Jun 2024 17:53:04 +0000 Subject: [PATCH] fix(gui-client/windows): show a tooltip when the mouse hovers over the tray icon (#5548) Closes #5547 **Only works on Windows** due to a limitation in or below Tauri. image --- rust/gui-client/src-tauri/src/client/gui.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rust/gui-client/src-tauri/src/client/gui.rs b/rust/gui-client/src-tauri/src/client/gui.rs index a0100dcbd..69dfd1e48 100644 --- a/rust/gui-client/src-tauri/src/client/gui.rs +++ b/rust/gui-client/src-tauri/src/client/gui.rs @@ -44,6 +44,8 @@ pub(crate) use os::set_autostart; pub(crate) type CtlrTx = mpsc::Sender; +const TRAY_ICON_TOOLTIP: &str = "Firezone"; + /// All managed state that we might need to access from odd places like Tauri commands. /// /// Note that this never gets Dropped because of @@ -102,7 +104,9 @@ pub(crate) fn run( inject_faults: cli.inject_faults, }; - let tray = SystemTray::new().with_menu(system_tray_menu::signed_out()); + let tray = SystemTray::new() + .with_menu(system_tray_menu::signed_out()) + .with_tooltip(TRAY_ICON_TOOLTIP); tracing::info!("Setting up Tauri app instance..."); let (setup_result_tx, mut setup_result_rx) = @@ -652,10 +656,10 @@ impl Controller { /// Builds a new system tray menu and applies it to the app fn refresh_system_tray_menu(&self) -> Result<()> { - Ok(self - .app - .tray_handle() - .set_menu(self.build_system_tray_menu())?) + let tray = self.app.tray_handle(); + tray.set_tooltip(TRAY_ICON_TOOLTIP)?; + tray.set_menu(self.build_system_tray_menu())?; + Ok(()) } /// Deletes the auth token, stops connlib, and refreshes the tray menu