mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-07 21:45:19 +02:00
fix(wm): float monocle + max windows
This commit ensures that monocle containers and maximized windows are considered valid candidates for the 'toggle-float' command and are handled accordingly if the command is called when they are in the foreground. fix #193
This commit is contained in:
+35
-13
@@ -648,22 +648,44 @@ impl Workspace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_floating_window(&mut self) -> Result<()> {
|
pub fn new_floating_window(&mut self) -> Result<()> {
|
||||||
let focused_idx = self.focused_container_idx();
|
let window = if let Some(maximized_window) = self.maximized_window() {
|
||||||
|
let window = *maximized_window;
|
||||||
|
self.set_maximized_window(None);
|
||||||
|
self.set_maximized_window_restore_idx(None);
|
||||||
|
window
|
||||||
|
} else if let Some(monocle_container) = self.monocle_container_mut() {
|
||||||
|
let window = monocle_container
|
||||||
|
.remove_focused_window()
|
||||||
|
.ok_or_else(|| anyhow!("there is no window"))?;
|
||||||
|
|
||||||
let container = self
|
if monocle_container.windows().is_empty() {
|
||||||
.focused_container_mut()
|
self.set_monocle_container(None);
|
||||||
.ok_or_else(|| anyhow!("there is no container"))?;
|
self.set_monocle_container_restore_idx(None);
|
||||||
|
} else {
|
||||||
|
monocle_container.load_focused_window();
|
||||||
|
}
|
||||||
|
|
||||||
let window = container
|
window
|
||||||
.remove_focused_window()
|
|
||||||
.ok_or_else(|| anyhow!("there is no window"))?;
|
|
||||||
|
|
||||||
if container.windows().is_empty() {
|
|
||||||
self.containers_mut().remove(focused_idx);
|
|
||||||
self.resize_dimensions_mut().remove(focused_idx);
|
|
||||||
} else {
|
} else {
|
||||||
container.load_focused_window();
|
let focused_idx = self.focused_container_idx();
|
||||||
}
|
|
||||||
|
let container = self
|
||||||
|
.focused_container_mut()
|
||||||
|
.ok_or_else(|| anyhow!("there is no container"))?;
|
||||||
|
|
||||||
|
let window = container
|
||||||
|
.remove_focused_window()
|
||||||
|
.ok_or_else(|| anyhow!("there is no window"))?;
|
||||||
|
|
||||||
|
if container.windows().is_empty() {
|
||||||
|
self.containers_mut().remove(focused_idx);
|
||||||
|
self.resize_dimensions_mut().remove(focused_idx);
|
||||||
|
} else {
|
||||||
|
container.load_focused_window();
|
||||||
|
}
|
||||||
|
|
||||||
|
window
|
||||||
|
};
|
||||||
|
|
||||||
self.floating_windows_mut().push(window);
|
self.floating_windows_mut().push(window);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user