Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix: prevent window from being minimized via toggle commands and restoring from fullscreen (#1071)

Vladyslav Remnov882917e044fc
diff --git a/packages/wm/src/events/handle_window_location_changed.rs b/packages/wm/src/events/handle_window_location_changed.rs
index 2dd87844..bfb2fb2d 100644
--- a/packages/wm/src/events/handle_window_location_changed.rs
+++ b/packages/wm/src/events/handle_window_location_changed.rs
@@ -89,13 +89,9 @@ pub fn handle_window_location_changed(
{
info!("Window restored from fullscreen: {window}");
- let target_state = window
- .prev_state()
- .unwrap_or(WindowState::default_from_config(&config.value));
-
update_window_state(
window.clone(),
- target_state,
+ window.toggled_state(window.state(), config),
state,
config,
)?;
diff --git a/packages/wm/src/traits/window_getters.rs b/packages/wm/src/traits/window_getters.rs
index 80fa7e0c..1c597e29 100644
--- a/packages/wm/src/traits/window_getters.rs
+++ b/packages/wm/src/traits/window_getters.rs
@@ -25,7 +25,7 @@ pub trait WindowGetters {
/// This will return the first valid state in the following order:
/// 1. If the window is not currently in the target state, return the
/// target state.
- /// 2. The previous state exists if one exists.
+ /// 2. The previous state exists if one exists (excluding minimized).
/// 3. The state from `window_behavior.initial_state` in the user config.
/// 4. Default to either floating/tiling depending on the current state.
fn toggled_state(
@@ -35,7 +35,9 @@ pub trait WindowGetters {
) -> WindowState {
let possible_states = [
Some(target_state),
- self.prev_state(),
+ self
+ .prev_state()
+ .filter(|state| state != WindowState::Minimized),
Some(WindowState::default_from_config(&config.value)),
];