mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-17 09:17:02 +02:00
fix(wm): reset global configs to default on removal
This commit is contained in:
@@ -457,10 +457,13 @@ impl Placement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Display, EnumString, ValueEnum)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize, Display, EnumString, ValueEnum,
|
||||||
|
)]
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum MoveBehaviour {
|
pub enum MoveBehaviour {
|
||||||
/// Swap the window container with the window container at the edge of the adjacent monitor
|
/// Swap the window container with the window container at the edge of the adjacent monitor
|
||||||
|
#[default]
|
||||||
Swap,
|
Swap,
|
||||||
/// Insert the window container into the focused workspace on the adjacent monitor
|
/// Insert the window container into the focused workspace on the adjacent monitor
|
||||||
Insert,
|
Insert,
|
||||||
@@ -468,12 +471,15 @@ pub enum MoveBehaviour {
|
|||||||
NoOp,
|
NoOp,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq,
|
||||||
|
)]
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum CrossBoundaryBehaviour {
|
pub enum CrossBoundaryBehaviour {
|
||||||
/// Attempt to perform actions across a workspace boundary
|
/// Attempt to perform actions across a workspace boundary
|
||||||
Workspace,
|
Workspace,
|
||||||
/// Attempt to perform actions across a monitor boundary
|
/// Attempt to perform actions across a monitor boundary
|
||||||
|
#[default]
|
||||||
Monitor,
|
Monitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,10 +494,13 @@ pub enum HidingBehaviour {
|
|||||||
Cloak,
|
Cloak,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Display, EnumString, ValueEnum)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize, Display, EnumString, ValueEnum,
|
||||||
|
)]
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub enum OperationBehaviour {
|
pub enum OperationBehaviour {
|
||||||
/// Process komorebic commands on temporarily unmanaged/floated windows
|
/// Process komorebic commands on temporarily unmanaged/floated windows
|
||||||
|
#[default]
|
||||||
Op,
|
Op,
|
||||||
/// Ignore komorebic commands on temporarily unmanaged/floated windows
|
/// Ignore komorebic commands on temporarily unmanaged/floated windows
|
||||||
NoOp,
|
NoOp,
|
||||||
|
|||||||
@@ -1659,42 +1659,12 @@ impl StaticConfig {
|
|||||||
|
|
||||||
wm.enforce_workspace_rules()?;
|
wm.enforce_workspace_rules()?;
|
||||||
|
|
||||||
if let Some(enabled) = value.border {
|
border_manager::BORDER_ENABLED.store(value.border.unwrap_or(true), Ordering::SeqCst);
|
||||||
border_manager::BORDER_ENABLED.store(enabled, Ordering::SeqCst);
|
wm.window_management_behaviour.current_behaviour =
|
||||||
}
|
value.window_container_behaviour.unwrap_or_default();
|
||||||
|
wm.window_management_behaviour.float_override = value.float_override.unwrap_or_default();
|
||||||
if let Some(val) = value.window_container_behaviour {
|
wm.window_management_behaviour.floating_layer_behaviour =
|
||||||
wm.window_management_behaviour.current_behaviour = val;
|
value.floating_layer_behaviour.unwrap_or_default();
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(val) = value.float_override {
|
|
||||||
wm.window_management_behaviour.float_override = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(val) = value.floating_layer_behaviour {
|
|
||||||
wm.window_management_behaviour.floating_layer_behaviour = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(val) = value.cross_monitor_move_behaviour {
|
|
||||||
wm.cross_monitor_move_behaviour = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(val) = value.cross_boundary_behaviour {
|
|
||||||
wm.cross_boundary_behaviour = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(val) = value.unmanaged_window_operation_behaviour {
|
|
||||||
wm.unmanaged_window_operation_behaviour = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(val) = value.resize_delta {
|
|
||||||
wm.resize_delta = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(val) = value.mouse_follows_focus {
|
|
||||||
wm.mouse_follows_focus = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
wm.window_management_behaviour.toggle_float_placement = value
|
wm.window_management_behaviour.toggle_float_placement = value
|
||||||
.toggle_float_placement
|
.toggle_float_placement
|
||||||
.unwrap_or(Placement::CenterAndResize);
|
.unwrap_or(Placement::CenterAndResize);
|
||||||
@@ -1704,9 +1674,17 @@ impl StaticConfig {
|
|||||||
value.float_override_placement.unwrap_or(Placement::None);
|
value.float_override_placement.unwrap_or(Placement::None);
|
||||||
wm.window_management_behaviour.float_rule_placement =
|
wm.window_management_behaviour.float_rule_placement =
|
||||||
value.float_rule_placement.unwrap_or(Placement::None);
|
value.float_rule_placement.unwrap_or(Placement::None);
|
||||||
|
wm.cross_monitor_move_behaviour = value.cross_monitor_move_behaviour.unwrap_or_default();
|
||||||
|
wm.cross_boundary_behaviour = value.cross_boundary_behaviour.unwrap_or_default();
|
||||||
|
wm.unmanaged_window_operation_behaviour = value
|
||||||
|
.unmanaged_window_operation_behaviour
|
||||||
|
.unwrap_or_default();
|
||||||
|
wm.resize_delta = value.resize_delta.unwrap_or(50);
|
||||||
|
wm.mouse_follows_focus = value.mouse_follows_focus.unwrap_or(true);
|
||||||
wm.work_area_offset = value.global_work_area_offset;
|
wm.work_area_offset = value.global_work_area_offset;
|
||||||
|
wm.focus_follows_mouse = value.focus_follows_mouse;
|
||||||
|
|
||||||
match value.focus_follows_mouse {
|
match wm.focus_follows_mouse {
|
||||||
None => WindowsApi::disable_focus_follows_mouse()?,
|
None => WindowsApi::disable_focus_follows_mouse()?,
|
||||||
Some(FocusFollowsMouseImplementation::Windows) => {
|
Some(FocusFollowsMouseImplementation::Windows) => {
|
||||||
WindowsApi::enable_focus_follows_mouse()?;
|
WindowsApi::enable_focus_follows_mouse()?;
|
||||||
@@ -1714,8 +1692,6 @@ impl StaticConfig {
|
|||||||
Some(FocusFollowsMouseImplementation::Komorebi) => {}
|
Some(FocusFollowsMouseImplementation::Komorebi) => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
wm.focus_follows_mouse = value.focus_follows_mouse;
|
|
||||||
|
|
||||||
let monitor_count = wm.monitors().len();
|
let monitor_count = wm.monitors().len();
|
||||||
|
|
||||||
for i in 0..monitor_count {
|
for i in 0..monitor_count {
|
||||||
|
|||||||
Reference in New Issue
Block a user