aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-11-27 20:49:07 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-11-27 20:55:20 +0300
commit815fa379ea1ba2ed9c9efff94e0b48374185f5de (patch)
tree7c60ede3a0030abd7c5d77a76ef99643b993caa7
parent4c480a1ea3280733bc428d9cb38150bfc1a7c36c (diff)
downloadniri-815fa379ea1ba2ed9c9efff94e0b48374185f5de.tar.gz
niri-815fa379ea1ba2ed9c9efff94e0b48374185f5de.tar.bz2
niri-815fa379ea1ba2ed9c9efff94e0b48374185f5de.zip
layout: Stop workspace switch when moving workspaces to primary
Okay, this might be one of the oldest layout issues to have remained uncaught. Well, maybe as I add more randomized tests, I'll catch even more of those.
-rw-r--r--src/layout/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index cf61e87a..596079e0 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -634,6 +634,14 @@ impl<W: LayoutElement> Layout<W> {
ws.set_output(Some(primary.output.clone()));
}
+ let mut stopped_primary_ws_switch = false;
+ if !workspaces.is_empty() && primary.workspace_switch.is_some() {
+ // FIXME: if we're adding workspaces to currently invisible positions
+ // (outside the workspace switch), we don't need to cancel it.
+ primary.workspace_switch = None;
+ stopped_primary_ws_switch = true;
+ }
+
let empty_was_focused =
primary.active_workspace_idx == primary.workspaces.len() - 1;
@@ -648,6 +656,10 @@ impl<W: LayoutElement> Layout<W> {
primary.active_workspace_idx = primary.workspaces.len() - 1;
}
+ if stopped_primary_ws_switch {
+ primary.clean_up_workspaces();
+ }
+
MonitorSet::Normal {
monitors,
primary_idx,