From b4e255a92e415d34fdeb306292faae78b3e82102 Mon Sep 17 00:00:00 2001 From: Exidex <16986685+exidex@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:21:34 +0100 Subject: [PATCH] Fix window jumping to another screen if pressing global shortcut with window open when using active monitor position mode --- rust/client/src/ui/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rust/client/src/ui/mod.rs b/rust/client/src/ui/mod.rs index 66cd03d..0dec384 100644 --- a/rust/client/src/ui/mod.rs +++ b/rust/client/src/ui/mod.rs @@ -67,6 +67,7 @@ pub struct AppModel { frontend_receiver: Arc>>, main_window_id: window::Id, focused: bool, + opened: bool, wayland: bool, #[cfg(any(target_os = "macos", target_os = "windows"))] tray_icon: tray_icon::TrayIcon, @@ -523,6 +524,7 @@ fn new( frontend_receiver: Arc::new(TokioRwLock::new(frontend_receiver)), main_window_id, focused: false, + opened: !minimized, wayland, #[cfg(any(target_os = "macos", target_os = "windows"))] tray_icon: sys_tray::create_tray(), @@ -2006,6 +2008,7 @@ impl AppModel { fn hide_window(&mut self) -> Task { self.focused = false; + self.opened = false; let mut commands = vec![]; @@ -2049,6 +2052,12 @@ impl AppModel { } fn show_window(&mut self) -> Task { + if self.opened { + return Task::none() + } + + self.opened = true; + #[cfg(target_os = "linux")] let open_task = if self.wayland { let (_, open_task) = open_main_window_wayland(self.main_window_id);