diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-07 13:15:20 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-07 13:16:54 +0400 |
| commit | 4b8e04da041a0cb6b07afe5405bef7e4a61bce5b (patch) | |
| tree | 5756215b6abd7ceca14bf6546707745b2bb6c2e2 /src/layout/workspace.rs | |
| parent | 026ad8f3778f07da49f0d005739f47cfa6269a36 (diff) | |
| download | niri-4b8e04da041a0cb6b07afe5405bef7e4a61bce5b.tar.gz niri-4b8e04da041a0cb6b07afe5405bef7e4a61bce5b.tar.bz2 niri-4b8e04da041a0cb6b07afe5405bef7e4a61bce5b.zip | |
Activate the new right_of window on its workspace
This way when a dialog opens on a different workspace, the user will see
it right away when they switch to that workspace.
Diffstat (limited to 'src/layout/workspace.rs')
| -rw-r--r-- | src/layout/workspace.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 47be5877..07a94321 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -559,18 +559,17 @@ impl<W: LayoutElement> Workspace<W> { &mut self, right_of: &W, window: W, - activate: bool, width: ColumnWidth, is_full_width: bool, ) { self.enter_output_for_window(&window); - let idx = self + let right_of_idx = self .columns .iter() .position(|col| col.contains(right_of)) - .unwrap() - + 1; + .unwrap(); + let idx = right_of_idx + 1; let column = Column::new( window, @@ -582,13 +581,12 @@ impl<W: LayoutElement> Workspace<W> { ); self.columns.insert(idx, column); - if self.active_column_idx >= idx { - self.active_column_idx += 1; - } - - if activate { + // Activate the new window if right_of was active. + if self.active_column_idx == right_of_idx { self.activate_column(idx); self.activate_prev_column_on_removal = true; + } else if idx <= self.active_column_idx { + self.active_column_idx += 1; } } |
