Skip to content

Commit

Permalink
fix(wm): hide non-focused windows in containers
Browse files Browse the repository at this point in the history
This commit ensures that every non-focused index in a Ring<Window> will
be hidden when a new window is added and focused via
Container::add_window, which typically happens when
WindowContainerBehaviour::Append is enabled and a new window is opened.

re #889
  • Loading branch information
LGUG2Z committed Jun 25, 2024
1 parent 7b1ece9 commit 1d0ac9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions komorebi/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ impl Container {
pub fn add_window(&mut self, window: Window) {
self.windows_mut().push_back(window);
self.focus_window(self.windows().len().saturating_sub(1));
let focused_window_idx = self.focused_window_idx();

for (i, window) in self.windows().iter().enumerate() {
if i != focused_window_idx {
window.hide();
}
}
}

#[tracing::instrument(skip(self))]
Expand Down
4 changes: 4 additions & 0 deletions komorebi/src/process_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ impl WindowManager {
.ok_or_else(|| anyhow!("there is no focused container"))?
.add_window(window);
self.update_focused_workspace(true, false)?;

stackbar_manager::send_notification();
}
}
}
Expand Down Expand Up @@ -546,6 +548,8 @@ impl WindowManager {
)?;
}
}

stackbar_manager::send_notification();
}
}
}
Expand Down

0 comments on commit 1d0ac9b

Please sign in to comment.