mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-24 18:31:22 +01:00
fix(wm): preserve resize dimensions on promotion
Whatever resize dimensions are at the front of the workspace were previously being thrown away and overwritten with None whenever a Promote command was being handled. This commit preserves any resize dimensions that may already be there and restores them after the container promotion has been completed. fix #40
This commit is contained in:
@@ -48,7 +48,6 @@ pub struct Workspace {
|
||||
#[serde(skip_serializing)]
|
||||
#[getset(get = "pub", set = "pub")]
|
||||
latest_layout: Vec<Rect>,
|
||||
#[serde(skip_serializing)]
|
||||
#[getset(get = "pub", get_mut = "pub")]
|
||||
resize_dimensions: Vec<Option<Rect>>,
|
||||
#[getset(get = "pub", set = "pub")]
|
||||
@@ -324,11 +323,14 @@ impl Workspace {
|
||||
}
|
||||
|
||||
pub fn promote_container(&mut self) -> Result<()> {
|
||||
let resize = self.resize_dimensions_mut().remove(0);
|
||||
let container = self
|
||||
.remove_focused_container()
|
||||
.ok_or_else(|| anyhow!("there is no container"))?;
|
||||
|
||||
self.containers_mut().push_front(container);
|
||||
self.resize_dimensions_mut().insert(0, None);
|
||||
self.resize_dimensions_mut().insert(0, resize);
|
||||
|
||||
self.focus_container(0);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user