aboutsummaryrefslogtreecommitdiff
path: root/src/layout/floating.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-02-05 17:18:21 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-02-05 17:25:51 +0300
commitc41f93a468c4d04e16f8c89736cc48cd4ab4c623 (patch)
tree3f6e8fb315550288b4e293e873b13dbf2d421486 /src/layout/floating.rs
parent900da597e4d3d09ad4c4ddc3ba2abf58c4886ec9 (diff)
downloadniri-c41f93a468c4d04e16f8c89736cc48cd4ab4c623.tar.gz
niri-c41f93a468c4d04e16f8c89736cc48cd4ab4c623.tar.bz2
niri-c41f93a468c4d04e16f8c89736cc48cd4ab4c623.zip
Add focus-window-top/bottom/down-or-top/up-or-bottom actions
Diffstat (limited to 'src/layout/floating.rs')
-rw-r--r--src/layout/floating.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/layout/floating.rs b/src/layout/floating.rs
index b908d920..15c99e87 100644
--- a/src/layout/floating.rs
+++ b/src/layout/floating.rs
@@ -833,6 +833,26 @@ impl<W: LayoutElement> FloatingSpace<W> {
}
}
+ pub fn focus_topmost(&mut self) {
+ let result = self
+ .tiles_with_offsets()
+ .min_by(|(_, pos_a), (_, pos_b)| f64::total_cmp(&pos_a.y, &pos_b.y));
+ if let Some((tile, _)) = result {
+ let id = tile.window().id().clone();
+ self.activate_window(&id);
+ }
+ }
+
+ pub fn focus_bottommost(&mut self) {
+ let result = self
+ .tiles_with_offsets()
+ .max_by(|(_, pos_a), (_, pos_b)| f64::total_cmp(&pos_a.y, &pos_b.y));
+ if let Some((tile, _)) = result {
+ let id = tile.window().id().clone();
+ self.activate_window(&id);
+ }
+ }
+
fn move_to(&mut self, idx: usize, new_pos: Point<f64, Logical>, animate: bool) {
if animate {
self.move_and_animate(idx, new_pos);