Skip to content

Commit

Permalink
fix(grid): enables flip_layout and make it behave correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
javierportillo authored and LGUG2Z committed Feb 25, 2024
1 parent 98244b9 commit eab7a64
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
22 changes: 19 additions & 3 deletions komorebi-core/src/arrangement.rs
Expand Up @@ -156,11 +156,27 @@ impl Arrangement for DefaultLayout {

for row in 0..num_rows_in_this_col {
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.right = win_width;

win.left = area.left + win_width * col;
win.top = area.top + win_height * row;
win.left = left;
win.top = top;
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions komorebi/src/window_manager.rs
Expand Up @@ -1658,11 +1658,6 @@ impl WindowManager {
pub fn flip_layout(&mut self, layout_flip: Axis) -> Result<()> {
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");

#[allow(clippy::match_same_arms)]
Expand Down

0 comments on commit eab7a64

Please sign in to comment.