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:
parent
d353779c10
commit
9bd7e14b08
3 changed files with 40 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue