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();

View file

@ -549,7 +549,11 @@ impl Renderer<'_> {
let tpuh = theme.title_plus_underline_height();
let tuh = theme.title_underline_height();
let bw = theme.sizes.border_width.get();
let bc = theme.colors.border.get();
let bc = if floating.active.get() {
theme.colors.focused_title_background.get()
} else {
theme.colors.border.get()
};
let tc = if floating.active.get() {
theme.colors.focused_title_background.get()
} else if floating.attention_requested.get() {

View file

@ -483,6 +483,9 @@ impl FloatNode {
fn update_child_active(self: &Rc<Self>, active: bool) {
if self.active.replace(active) != active {
self.schedule_render_titles();
if active {
self.restack();
}
}
}