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:57 +0300
commita444efd0ebee8e203877daedc7bc65584f72daba (patch)
tree2ca010493711213ee3faced62b63a62048f37bad /src/layout/scrolling.rs
parentc41f93a468c4d04e16f8c89736cc48cd4ab4c623 (diff)
downloadniri-a444efd0ebee8e203877daedc7bc65584f72daba.tar.gz
niri-a444efd0ebee8e203877daedc7bc65584f72daba.tar.bz2
niri-a444efd0ebee8e203877daedc7bc65584f72daba.zip
Add focus-window-in-column (by index) action
Diffstat (limited to 'src/layout/scrolling.rs')
-rw-r--r--src/layout/scrolling.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index 07890284..da193e0d 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -1362,6 +1362,14 @@ impl<W: LayoutElement> ScrollingSpace<W> {
self.activate_column(self.columns.len() - 1);
}
+ pub fn focus_window_in_column(&mut self, index: u8) {
+ if self.columns.is_empty() {
+ return;
+ }
+
+ self.columns[self.active_column_idx].focus_index(index);
+ }
+
pub fn focus_down(&mut self) -> bool {
if self.columns.is_empty() {
return false;
@@ -3614,6 +3622,10 @@ impl<W: LayoutElement> Column<W> {
.unwrap()
}
+ fn focus_index(&mut self, index: u8) {
+ self.active_tile_idx = min(usize::from(index.saturating_sub(1)), self.tiles.len() - 1);
+ }
+
fn focus_up(&mut self) -> bool {
if self.active_tile_idx == 0 {
return false;