diff --git a/crates/komorebi-core/src/container.rs b/crates/komorebi-core/src/container.rs index 73bba815..0b6b9d90 100644 --- a/crates/komorebi-core/src/container.rs +++ b/crates/komorebi-core/src/container.rs @@ -19,10 +19,11 @@ use std::collections::VecDeque; /// What a container needs of a platform's window. /// -/// The window is a small `Copy` handle (Windows: an `HWND`; KDE: the compositor's id). Showing and +/// The window is a handle that is cheap to clone (Windows: an `HWND`; KDE: the compositor's id; macOS: an +/// Accessibility element). Showing and /// hiding it is the platform's business, so the container calls these four operations and nothing /// else; none of them reports a failure, because a window that cannot be hidden is left where it is. -pub trait ContainerWindow: Copy + PartialEq + std::fmt::Debug { +pub trait ContainerWindow: Clone + PartialEq + std::fmt::Debug { /// What names a window to the rest of the daemon: `isize` on Windows, `u32` on KDE. type Id: Copy + PartialEq; diff --git a/crates/komorebi-core/src/workspace.rs b/crates/komorebi-core/src/workspace.rs index d6bd9703..88bc906a 100644 --- a/crates/komorebi-core/src/workspace.rs +++ b/crates/komorebi-core/src/workspace.rs @@ -654,7 +654,7 @@ impl Workspace

{ /// The compositor reports no focused window. pub fn is_focused_window_monocle_or_maximized(&self) -> eyre::Result { let window_id = P::foreground_window_id().ok_or_eyre("no foreground window")?; - if let Some(window) = self.maximized_window + if let Some(window) = &self.maximized_window && window_id == window.id() { return Ok(true); @@ -683,7 +683,7 @@ impl Workspace

{ } } - if let Some(window) = self.maximized_window + if let Some(window) = &self.maximized_window && window_id == window.id() { return true; @@ -716,7 +716,7 @@ impl Workspace

{ } } - if let Some(window) = self.maximized_window + if let Some(window) = &self.maximized_window && let Some(window_exe) = window.exe() && exe == window_exe { @@ -750,7 +750,7 @@ impl Workspace

{ } } - if let Some(window) = self.maximized_window + if let Some(window) = &self.maximized_window && window_id == window.id() { return true; @@ -839,7 +839,7 @@ impl Workspace

{ container.load_focused_window(); } - self.new_container_for_window(window); + self.new_container_for_window(window.clone()); let mut container = Container::default(); container.add_window(window); @@ -1392,7 +1392,7 @@ impl Workspace

{ /// Takes the focused window of the workspace (the maximized one, the monocle's or the focused /// container's) out of its place and makes it a floating window. pub fn new_floating_window(&mut self) -> eyre::Result<()> { - let window = if let Some(maximized_window) = self.maximized_window { + let window = if let Some(maximized_window) = self.maximized_window.clone() { P::unmaximize_window(&maximized_window)?; self.maximized_window = None; self.maximized_window_restore_idx = None; @@ -1467,7 +1467,7 @@ impl Workspace

{ self.resize_dimensions = resize_dimensions; } - if let Some(window) = self.maximized_window { + if let Some(window) = &self.maximized_window { window.hide_window(); }