feat(wm): enforce last known layout on unpause

This commit ensures that the last known layout is restored on a
workspace when a command to unpause has been received.
This commit is contained in:
LGUG2Z
2021-11-19 16:34:35 -08:00
parent 84ccfedad4
commit b1ca0a3e3c
2 changed files with 9 additions and 6 deletions

View File

@@ -143,6 +143,7 @@ impl WindowManager {
}
self.is_paused = !self.is_paused;
self.retile_all(true)?;
}
SocketMessage::ToggleTiling => {
self.toggle_tiling()?;
@@ -161,7 +162,7 @@ impl WindowManager {
self.focus_monitor(monitor_idx)?;
self.update_focused_workspace(self.mouse_follows_focus)?;
}
SocketMessage::Retile => self.retile_all()?,
SocketMessage::Retile => self.retile_all(false)?,
SocketMessage::FlipLayout(layout_flip) => self.flip_layout(layout_flip)?,
SocketMessage::ChangeLayout(layout) => self.change_workspace_layout_default(layout)?,
SocketMessage::ChangeLayoutCustom(path) => self.change_workspace_custom_layout(path)?,
@@ -464,11 +465,11 @@ impl WindowManager {
}
SocketMessage::InvisibleBorders(rect) => {
self.invisible_borders = rect;
self.retile_all()?;
self.retile_all(false)?;
}
SocketMessage::WorkAreaOffset(rect) => {
self.work_area_offset = Option::from(rect);
self.retile_all()?;
self.retile_all(false)?;
}
SocketMessage::QuickSave => {
let workspace = self.focused_workspace()?;

View File

@@ -443,7 +443,7 @@ impl WindowManager {
}
#[tracing::instrument(skip(self))]
pub fn retile_all(&mut self) -> Result<()> {
pub fn retile_all(&mut self, preserve_resize_dimensions: bool) -> Result<()> {
let invisible_borders = self.invisible_borders;
let offset = self.work_area_offset;
@@ -454,8 +454,10 @@ impl WindowManager {
.ok_or_else(|| anyhow!("there is no workspace"))?;
// Reset any resize adjustments if we want to force a retile
for resize in workspace.resize_dimensions_mut() {
*resize = None;
if !preserve_resize_dimensions {
for resize in workspace.resize_dimensions_mut() {
*resize = None;
}
}
workspace.update(&work_area, offset, &invisible_borders)?;