Skip to content

Commit

Permalink
Fix window jumping to another screen if pressing global shortcut with…
Browse files Browse the repository at this point in the history
… window open when using active monitor position mode
  • Loading branch information
Exidex committed Jan 16, 2025
1 parent 47bf9f2 commit b4e255a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rust/client/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct AppModel {
frontend_receiver: Arc<TokioRwLock<RequestReceiver<UiRequestData, UiResponseData>>>,
main_window_id: window::Id,
focused: bool,
opened: bool,
wayland: bool,
#[cfg(any(target_os = "macos", target_os = "windows"))]
tray_icon: tray_icon::TrayIcon,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -2006,6 +2008,7 @@ impl AppModel {

fn hide_window(&mut self) -> Task<AppMsg> {
self.focused = false;
self.opened = false;

let mut commands = vec![];

Expand Down Expand Up @@ -2049,6 +2052,12 @@ impl AppModel {
}

fn show_window(&mut self) -> Task<AppMsg> {
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);
Expand Down

0 comments on commit b4e255a

Please sign in to comment.