feat: resize tiled windows directionally
This commit is contained in:
1 parent
0d9bbe49f7
commit
4e4a44e210
3 files changed
+162
-3
No files matched your search
@@ -34,7 +34,10 @@ impl Ferese {
|
||||
return FilterResult::Intercept(());
|
||||
}
|
||||
|
||||
let direction = if modifiers.logo && !modifiers.ctrl && !modifiers.alt {
|
||||
let supported_modifiers = modifiers.logo
|
||||
&& !modifiers.alt
|
||||
&& !(modifiers.ctrl && modifiers.shift);
|
||||
let direction = if supported_modifiers {
|
||||
match keysym.modified_sym().raw() {
|
||||
keysyms::KEY_h | keysyms::KEY_H => Some(Direction::Left),
|
||||
keysyms::KEY_j | keysyms::KEY_J => Some(Direction::Down),
|
||||
@@ -49,9 +52,12 @@ impl Ferese {
|
||||
if let Some(direction) = direction {
|
||||
if state == KeyState::Pressed {
|
||||
data.intercepted_keys.insert(keycode);
|
||||
if modifiers.shift {
|
||||
|
||||
if modifiers.ctrl && !modifiers.shift {
|
||||
data.resize_direction(direction);
|
||||
} else if modifiers.shift && !modifiers.ctrl {
|
||||
data.move_direction(direction);
|
||||
} else {
|
||||
} else if !modifiers.ctrl && !modifiers.shift {
|
||||
data.focus_direction(direction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +293,20 @@ impl Ferese {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn resize_direction(&mut self, direction: Direction) {
|
||||
const RESIZE_STEP: f64 = 0.05;
|
||||
|
||||
let Some(current) = self.focused_window else {
|
||||
return;
|
||||
};
|
||||
|
||||
match self.layout.resize_window(current, direction, RESIZE_STEP) {
|
||||
Ok(true) => self.relayout(),
|
||||
Ok(false) => {}
|
||||
Err(error) => tracing::error!(%error, ?current, "failed to resize tiled window"),
|
||||
}
|
||||
}
|
||||
|
||||
fn output_bounds(&self) -> Option<Rect> {
|
||||
let output = self.space.outputs().next()?;
|
||||
let geometry = self.space.output_geometry(output)?;
|
||||
|
||||
Reference in new issue
Block a user