Skip to content

Commit

Permalink
feat(wm): remove min window resize dimensions
Browse files Browse the repository at this point in the history
This commit removes the minimum window resize dimensions restriction as
most apps now implement these restrictions themselves.

resolve #531
  • Loading branch information
LGUG2Z committed Jan 24, 2025
1 parent da156c0 commit 1101baa
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions komorebi/src/core/default_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ impl DefaultLayout {
return None;
};

let max_divisor = 1.005;
let mut r = resize.unwrap_or_default();

let resize_delta = delta;
Expand All @@ -108,63 +107,55 @@ impl DefaultLayout {
// against this; if people end up in this situation they are better off
// just hitting the retile command
let diff = ((r.left + -resize_delta) as f32).abs();
let max = unaltered.right as f32 / max_divisor;
if diff < max {
if diff < unaltered.right as f32 {
r.left += -resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.left - -resize_delta) as f32).abs();
let max = unaltered.right as f32 / max_divisor;
if diff < max {
if diff < unaltered.right as f32 {
r.left -= -resize_delta;
}
}
},
OperationDirection::Up => match sizing {
Sizing::Increase => {
let diff = ((r.top + resize_delta) as f32).abs();
let max = unaltered.bottom as f32 / max_divisor;
if diff < max {
if diff < unaltered.bottom as f32 {
r.top += -resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.top - resize_delta) as f32).abs();
let max = unaltered.bottom as f32 / max_divisor;
if diff < max {
if diff < unaltered.bottom as f32 {
r.top -= -resize_delta;
}
}
},
OperationDirection::Right => match sizing {
Sizing::Increase => {
let diff = ((r.right + resize_delta) as f32).abs();
let max = unaltered.right as f32 / max_divisor;
if diff < max {
if diff < unaltered.right as f32 {
r.right += resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.right - resize_delta) as f32).abs();
let max = unaltered.right as f32 / max_divisor;
if diff < max {
if diff < unaltered.right as f32 {
r.right -= resize_delta;
}
}
},
OperationDirection::Down => match sizing {
Sizing::Increase => {
let diff = ((r.bottom + resize_delta) as f32).abs();
let max = unaltered.bottom as f32 / max_divisor;
if diff < max {
if diff < unaltered.bottom as f32 {
r.bottom += resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.bottom - resize_delta) as f32).abs();
let max = unaltered.bottom as f32 / max_divisor;
if diff < max {
if diff < unaltered.bottom as f32 {
r.bottom -= resize_delta;
}
}
Expand Down

0 comments on commit 1101baa

Please sign in to comment.