add toggle focus between floating and tiled layers
Adds focus_floats(), toggle_focus_float_tiled(), and their IPC bindings so users can bind a key to swap focus between the floating and tiled layers.
This commit is contained in:
parent
23ad546a39
commit
d353779c10
8 changed files with 82 additions and 0 deletions
|
|
@ -1163,6 +1163,36 @@ impl WlSeatGlobal {
|
|||
);
|
||||
}
|
||||
|
||||
pub fn toggle_focus_float_tiled(self: &Rc<Self>) {
|
||||
let current = self.keyboard_node.get();
|
||||
match current.node_layer().layer() {
|
||||
NodeLayer::Tiled | NodeLayer::Fullscreen => self.focus_floats(),
|
||||
_ => self.focus_tiles(),
|
||||
}
|
||||
self.maybe_schedule_warp_mouse_to_focus();
|
||||
}
|
||||
|
||||
pub fn focus_floats(self: &Rc<Self>) {
|
||||
let current = self.keyboard_node.get();
|
||||
if current.node_layer().layer() == NodeLayer::Stacked {
|
||||
return;
|
||||
}
|
||||
let Some(output) = current.node_output() else {
|
||||
return;
|
||||
};
|
||||
let Some(ws) = output.workspace.get() else {
|
||||
return;
|
||||
};
|
||||
if let Some(child) = ws
|
||||
.stacked
|
||||
.rev_iter()
|
||||
.filter_map(|node| (*node).clone().node_into_float())
|
||||
.find_map(|float| float.child.get())
|
||||
{
|
||||
child.node_do_focus(self, Direction::Unspecified);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn focus_tiles(self: &Rc<Self>) {
|
||||
let current = self.keyboard_node.get();
|
||||
if matches!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue