aboutsummaryrefslogtreecommitdiff
path: root/src/layout/scrolling.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/scrolling.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/scrolling.rs')
-rw-r--r--src/layout/scrolling.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index d90150d8..07890284 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -1422,6 +1422,22 @@ impl<W: LayoutElement> ScrollingSpace<W> {
}
}
+ pub fn focus_top(&mut self) {
+ if self.columns.is_empty() {
+ return;
+ }
+
+ self.columns[self.active_column_idx].focus_top()
+ }
+
+ pub fn focus_bottom(&mut self) {
+ if self.columns.is_empty() {
+ return;
+ }
+
+ self.columns[self.active_column_idx].focus_bottom()
+ }
+
fn move_column_to(&mut self, new_idx: usize) {
if self.active_column_idx == new_idx {
return;
@@ -3616,6 +3632,14 @@ impl<W: LayoutElement> Column<W> {
true
}
+ fn focus_top(&mut self) {
+ self.active_tile_idx = 0;
+ }
+
+ fn focus_bottom(&mut self) {
+ self.active_tile_idx = self.tiles.len() - 1;
+ }
+
fn move_up(&mut self) -> bool {
let new_idx = self.active_tile_idx.saturating_sub(1);
if self.active_tile_idx == new_idx {