feat: move tiled windows directionally
This commit is contained in:
1 parent
8c1184ddda
commit
0d9bbe49f7
3 files changed
+87
-6
No files matched your search
@@ -34,11 +34,7 @@ impl Ferese {
|
||||
return FilterResult::Intercept(());
|
||||
}
|
||||
|
||||
let direction = if modifiers.logo
|
||||
&& !modifiers.ctrl
|
||||
&& !modifiers.alt
|
||||
&& !modifiers.shift
|
||||
{
|
||||
let direction = if modifiers.logo && !modifiers.ctrl && !modifiers.alt {
|
||||
match keysym.modified_sym().raw() {
|
||||
keysyms::KEY_h | keysyms::KEY_H => Some(Direction::Left),
|
||||
keysyms::KEY_j | keysyms::KEY_J => Some(Direction::Down),
|
||||
@@ -53,7 +49,11 @@ impl Ferese {
|
||||
if let Some(direction) = direction {
|
||||
if state == KeyState::Pressed {
|
||||
data.intercepted_keys.insert(keycode);
|
||||
data.focus_direction(direction);
|
||||
if modifiers.shift {
|
||||
data.move_direction(direction);
|
||||
} else {
|
||||
data.focus_direction(direction);
|
||||
}
|
||||
}
|
||||
|
||||
FilterResult::Intercept(())
|
||||
|
||||
@@ -278,6 +278,21 @@ impl Ferese {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn move_direction(&mut self, direction: Direction) {
|
||||
let Some(current) = self.focused_window else {
|
||||
return;
|
||||
};
|
||||
let Some(bounds) = self.output_bounds() else {
|
||||
return;
|
||||
};
|
||||
|
||||
match self.layout.move_window(current, direction, bounds) {
|
||||
Ok(true) => self.relayout(),
|
||||
Ok(false) => {}
|
||||
Err(error) => tracing::error!(%error, ?current, "failed to move 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