mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-19 07:54:04 +01:00
feat(wm): toggle float override with floating layer
This commit ensures that when the user switches to the flooating layer
any new spawned window will be spawned floating as if the float override
was set.
This results in a workflow which makes it easier to spawn floating
windows on the fly.
This effectively reverts commit ff2aa5e51a.
This commit is contained in:
@@ -634,12 +634,17 @@ impl WindowManager {
|
||||
self.window_management_behaviour.current_behaviour
|
||||
};
|
||||
|
||||
let float_override = if let Some(float_override) = workspace.float_override() {
|
||||
let mut float_override = if let Some(float_override) = workspace.float_override() {
|
||||
*float_override
|
||||
} else {
|
||||
self.window_management_behaviour.float_override
|
||||
};
|
||||
|
||||
// If the workspace layer is `Floating`, then consider it as if it had float
|
||||
// override so that new windows spawn as floating
|
||||
float_override =
|
||||
float_override || matches!(workspace.layer, WorkspaceLayer::Floating);
|
||||
|
||||
return WindowManagementBehaviour {
|
||||
current_behaviour,
|
||||
float_override,
|
||||
|
||||
@@ -88,7 +88,7 @@ pub struct Workspace {
|
||||
pub float_override: Option<bool>,
|
||||
#[getset(get = "pub", get_mut = "pub", set = "pub")]
|
||||
pub globals: WorkspaceGlobals,
|
||||
#[getset(get = "pub", get_mut = "pub")]
|
||||
#[getset(get = "pub", get_mut = "pub", set = "pub")]
|
||||
pub layer: WorkspaceLayer,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[getset(get = "pub", set = "pub")]
|
||||
@@ -593,19 +593,6 @@ impl Workspace {
|
||||
Ok((hwnds.len() + floating_hwnds.len(), container_ids.len()))
|
||||
}
|
||||
|
||||
pub fn set_layer(&mut self, layer: WorkspaceLayer) {
|
||||
self.layer = layer;
|
||||
|
||||
match layer {
|
||||
WorkspaceLayer::Tiling => {
|
||||
self.float_override = None;
|
||||
}
|
||||
WorkspaceLayer::Floating => {
|
||||
self.float_override = Some(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn container_for_window(&self, hwnd: isize) -> Option<&Container> {
|
||||
self.containers().get(self.container_idx_for_window(hwnd)?)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user