From 8e6aa34bbf125047160653d70f44c6a1ec4c067c Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Thu, 1 Jan 2026 16:22:04 -0800 Subject: [PATCH] fix(animation): disable on stacking operations This commit disables animations on stacking operations because it's just too much of a headache. Additionally, the borders get screwed up sometimes on unstacking, so we'll just go nuclear and destroy and recreate them on an unstack or unstack-all op. --- komorebi/src/process_command.rs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 71dc0f92..d999a99d 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -282,15 +282,37 @@ impl WindowManager { self.move_container_in_cycle_direction(direction)?; } - SocketMessage::StackWindow(direction) => self.add_window_to_container(direction)?, - SocketMessage::UnstackWindow => self.remove_window_from_container()?, - SocketMessage::StackAll => self.stack_all()?, - SocketMessage::UnstackAll => self.unstack_all(true)?, + SocketMessage::StackWindow(direction) => { + let restore = ANIMATION_ENABLED_GLOBAL.swap(false, Ordering::SeqCst); + self.add_window_to_container(direction)?; + ANIMATION_ENABLED_GLOBAL.store(restore, Ordering::SeqCst); + } + SocketMessage::UnstackWindow => { + let restore = ANIMATION_ENABLED_GLOBAL.swap(false, Ordering::SeqCst); + self.remove_window_from_container()?; + border_manager::destroy_all_borders()?; + ANIMATION_ENABLED_GLOBAL.store(restore, Ordering::SeqCst); + } + SocketMessage::StackAll => { + let restore = ANIMATION_ENABLED_GLOBAL.swap(false, Ordering::SeqCst); + self.stack_all()?; + ANIMATION_ENABLED_GLOBAL.store(restore, Ordering::SeqCst); + } + SocketMessage::UnstackAll => { + let restore = ANIMATION_ENABLED_GLOBAL.swap(false, Ordering::SeqCst); + self.unstack_all(true)?; + border_manager::destroy_all_borders()?; + ANIMATION_ENABLED_GLOBAL.store(restore, Ordering::SeqCst); + } SocketMessage::CycleStack(direction) => { + let restore = ANIMATION_ENABLED_GLOBAL.swap(false, Ordering::SeqCst); self.cycle_container_window_in_direction(direction)?; + ANIMATION_ENABLED_GLOBAL.store(restore, Ordering::SeqCst); } SocketMessage::CycleStackIndex(direction) => { + let restore = ANIMATION_ENABLED_GLOBAL.swap(false, Ordering::SeqCst); self.cycle_container_window_index_in_direction(direction)?; + ANIMATION_ENABLED_GLOBAL.store(restore, Ordering::SeqCst); } SocketMessage::FocusStackWindow(idx) => { // In case you are using this command on a bar on a monitor @@ -300,7 +322,9 @@ impl WindowManager { if let Some(monitor_idx) = self.monitor_idx_from_current_pos() { self.focus_monitor(monitor_idx)?; } + let restore = ANIMATION_ENABLED_GLOBAL.swap(false, Ordering::SeqCst); self.focus_container_window(idx)?; + ANIMATION_ENABLED_GLOBAL.store(restore, Ordering::SeqCst); } SocketMessage::Minimize => { let foreground_window =