mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-24 17:48:34 +02:00
fix(grid): enables flip_layout and make it behave correctly
This commit is contained in:
@@ -156,11 +156,27 @@ impl Arrangement for DefaultLayout {
|
|||||||
|
|
||||||
for row in 0..num_rows_in_this_col {
|
for row in 0..num_rows_in_this_col {
|
||||||
if let Some((_idx, win)) = iter.next() {
|
if let Some((_idx, win)) = iter.next() {
|
||||||
|
let mut left = area.left + win_width * col;
|
||||||
|
let mut top = area.top + win_height * row;
|
||||||
|
|
||||||
|
match layout_flip {
|
||||||
|
Some(Axis::Horizontal) => {
|
||||||
|
left = area.right - win_width * (col + 1) + area.left;
|
||||||
|
}
|
||||||
|
Some(Axis::Vertical) => {
|
||||||
|
top = area.bottom - win_height * (row + 1) + area.top;
|
||||||
|
}
|
||||||
|
Some(Axis::HorizontalAndVertical) => {
|
||||||
|
left = area.right - win_width * (col + 1) + area.left;
|
||||||
|
top = area.bottom - win_height * (row + 1) + area.top;
|
||||||
|
}
|
||||||
|
None => {} // No flip
|
||||||
|
}
|
||||||
|
|
||||||
win.bottom = win_height;
|
win.bottom = win_height;
|
||||||
win.right = win_width;
|
win.right = win_width;
|
||||||
|
win.left = left;
|
||||||
win.left = area.left + win_width * col;
|
win.top = top;
|
||||||
win.top = area.top + win_height * row;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1658,11 +1658,6 @@ impl WindowManager {
|
|||||||
pub fn flip_layout(&mut self, layout_flip: Axis) -> Result<()> {
|
pub fn flip_layout(&mut self, layout_flip: Axis) -> Result<()> {
|
||||||
let workspace = self.focused_workspace_mut()?;
|
let workspace = self.focused_workspace_mut()?;
|
||||||
|
|
||||||
if matches!(workspace.layout(), Layout::Default(DefaultLayout::Grid)) {
|
|
||||||
tracing::debug!("ignoring flip layout command for grid layout");
|
|
||||||
return Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
tracing::info!("flipping layout");
|
tracing::info!("flipping layout");
|
||||||
|
|
||||||
#[allow(clippy::match_same_arms)]
|
#[allow(clippy::match_same_arms)]
|
||||||
|
|||||||
Reference in New Issue
Block a user