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();
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue