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:
1 parent
b94f8c6b5f
commit
371dfe5264
2 files changed
+17
-1
No files matched your search
@@ -36,6 +36,7 @@ pub(crate) struct App {
|
||||
pub(crate) webviews: HashMap<WindowId, WebviewInstance>,
|
||||
pub(crate) float_all: bool,
|
||||
pub(crate) show_devtools: bool,
|
||||
pub(crate) tray_icon_show_window_on_click: bool,
|
||||
|
||||
/// This single blob of state is shared between all the windows so they have access to the runtime state
|
||||
///
|
||||
@@ -60,6 +61,8 @@ impl App {
|
||||
.take()
|
||||
.unwrap_or_else(|| EventLoopBuilder::<UserWindowEvent>::with_user_event().build());
|
||||
|
||||
let tray_icon_show_window_on_click = cfg.tray_icon_show_window_on_click;
|
||||
|
||||
let app = Self {
|
||||
exit_on_last_window_close: cfg.exit_on_last_window_close,
|
||||
disable_dma_buf_on_wayland: cfg.disable_dma_buf_on_wayland,
|
||||
@@ -69,6 +72,7 @@ impl App {
|
||||
unmounted_dom: Cell::new(Some(virtual_dom)),
|
||||
float_all: false,
|
||||
show_devtools: false,
|
||||
tray_icon_show_window_on_click,
|
||||
cfg: Cell::new(Some(cfg)),
|
||||
shared: Rc::new(SharedContext {
|
||||
event_handlers: WindowEventHandlers::default(),
|
||||
@@ -162,7 +166,7 @@ impl App {
|
||||
button_state: _,
|
||||
} = event
|
||||
{
|
||||
if button == tray_icon::MouseButton::Left {
|
||||
if button == tray_icon::MouseButton::Left && self.tray_icon_show_window_on_click {
|
||||
for webview in self.webviews.values() {
|
||||
webview.desktop_context.window.set_visible(true);
|
||||
webview.desktop_context.window.set_focus();
|
||||
|
||||
Reference in new issue
Block a user