feat: allow config for showing the main app on tray icon click (#5361)

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Matt JenkinsonandJonathan Kelley authored and GitHub committed 2026-03-26 17:14:10 -07:00
1 parent b94f8c6b5f
commit 371dfe5264
2 files changed
+17 -1

No files matched your search

+12
View File
@@ -69,6 +69,7 @@ pub struct Config {
pub(crate) disable_file_drop_handler: bool,
pub(crate) disable_dma_buf_on_wayland: bool,
pub(crate) additional_windows_args: Option<String>,
pub(crate) tray_icon_show_window_on_click: bool,
#[allow(clippy::type_complexity)]
pub(crate) on_window: Option<Box<dyn FnMut(Arc<Window>, &mut VirtualDom) + 'static>>,
@@ -122,6 +123,7 @@ impl Config {
disable_dma_buf_on_wayland: true,
on_window: None,
additional_windows_args: None,
tray_icon_show_window_on_click: true,
}
}
@@ -338,6 +340,16 @@ impl Config {
self.additional_windows_args = Some(additional_args.to_string());
self
}
/// Set whether the main window is shown and focused when the tray icon is left-clicked.
///
/// Defaults to `true` (preserves current behavior). Set to `false` for tray/menu bar apps
/// that only want to show the context menu when the tray icon is clicked, without
/// activating the main window.
pub fn with_tray_icon_show_window_on_click(mut self, show: bool) -> Self {
self.tray_icon_show_window_on_click = show;
self
}
}
impl Default for Config {