From 1376d7be047c58761e5afee52c65b2f5bf7456ea Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sun, 13 Oct 2024 10:04:09 -0700 Subject: [PATCH] feat(wm): add retile with resize socket msg This commit adds a new SocketMessage variant, RetileWithResizeDimensions, to preserve any resize dimensions applied by the user. This new variant is now used when clicking on a workspace using the komorebi widget in komorebi-bar. --- komorebi-bar/src/komorebi.rs | 5 ++++- komorebi/src/core/mod.rs | 1 + komorebi/src/process_command.rs | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/komorebi-bar/src/komorebi.rs b/komorebi-bar/src/komorebi.rs index 1d6040f01..a689352b4 100644 --- a/komorebi-bar/src/komorebi.rs +++ b/komorebi-bar/src/komorebi.rs @@ -164,7 +164,10 @@ impl BarWidget for Komorebi { proceed = false; } - if proceed && komorebi_client::send_message(&SocketMessage::Retile).is_err() { + if proceed + && komorebi_client::send_message(&SocketMessage::RetileWithResizeDimensions) + .is_err() + { tracing::error!("could not send message to komorebi: Retile"); } } diff --git a/komorebi/src/core/mod.rs b/komorebi/src/core/mod.rs index ee9929016..33bfa0d9f 100644 --- a/komorebi/src/core/mod.rs +++ b/komorebi/src/core/mod.rs @@ -103,6 +103,7 @@ pub enum SocketMessage { Stop, TogglePause, Retile, + RetileWithResizeDimensions, QuickSave, QuickLoad, Save(PathBuf), diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 0e79ee8cc..0cfa013e9 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -632,6 +632,11 @@ impl WindowManager { border_manager::destroy_all_borders()?; self.retile_all(false)? } + SocketMessage::RetileWithResizeDimensions => { + border_manager::BORDER_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst); + border_manager::destroy_all_borders()?; + self.retile_all(true)? + } SocketMessage::FlipLayout(layout_flip) => self.flip_layout(layout_flip)?, SocketMessage::ChangeLayout(layout) => self.change_workspace_layout_default(layout)?, SocketMessage::CycleLayout(direction) => self.cycle_layout(direction)?,