aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-11-24 09:48:37 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-11-24 09:48:37 +0400
commit34739650914fbfaa1a4144e929e64be4ca54bf5c (patch)
tree1b3c74bd0988ee694747732bf162d4ecefc1ae40 /src/input.rs
parentc9a79464da3245af944e692bb65db5b1f71d9ef7 (diff)
downloadniri-34739650914fbfaa1a4144e929e64be4ca54bf5c.tar.gz
niri-34739650914fbfaa1a4144e929e64be4ca54bf5c.tar.bz2
niri-34739650914fbfaa1a4144e929e64be4ca54bf5c.zip
layout: Change workspace by idx functions to accept 0-based usize
Makes more sense to do the converstion at the top of the call stack.
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/input.rs b/src/input.rs
index 347ef6c5..b7ceffd1 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -240,6 +240,7 @@ impl State {
self.niri.queue_redraw_all();
}
Action::MoveWindowToWorkspace(idx) => {
+ let idx = idx.saturating_sub(1) as usize;
self.niri.layout.move_to_workspace(idx);
// FIXME: granular
self.niri.queue_redraw_all();
@@ -255,6 +256,7 @@ impl State {
self.niri.queue_redraw_all();
}
Action::FocusWorkspace(idx) => {
+ let idx = idx.saturating_sub(1) as usize;
self.niri.layout.switch_workspace(idx);
// FIXME: granular
self.niri.queue_redraw_all();