1
0
Fork 0
forked from wry/wry

add directional focus navigation for floating windows

Map left/down to previous and right/up to next in the workspace
stacking order, with wrapping. Does not cross to the tiled layer.
This commit is contained in:
atagen 2026-03-07 19:03:12 +11:00 committed by kossLAN
parent d353779c10
commit 9bd7e14b08
No known key found for this signature in database
3 changed files with 40 additions and 1 deletions

View file

@ -826,6 +826,38 @@ impl WlSeatGlobal {
&& let Some(c) = p.node_into_container()
{
c.move_focus_from_child(self, tl.deref(), direction);
} else if let Some(float) = data.float.get()
{
let ws = float.workspace.get();
let floats: Vec<_> = ws
.stacked
.iter()
.filter_map(|node| (*node).clone().node_into_float())
.filter(|f| f.child.get().is_some())
.collect();
if let Some(pos) = floats.iter().position(|f| f.id == float.id) {
let target = match direction {
Direction::Left | Direction::Down => {
if pos == 0 {
floats.last()
} else {
floats.get(pos - 1)
}
}
_ => {
if pos + 1 >= floats.len() {
floats.first()
} else {
floats.get(pos + 1)
}
}
};
if let Some(f) = target
&& f.id != float.id
{
f.clone().node_do_focus(self, Direction::Unspecified);
}
}
}
}
self.maybe_schedule_warp_mouse_to_focus();