Skip to content

Commit

Permalink
fix(stackbar): destroy stackbars on ws change
Browse files Browse the repository at this point in the history
This commit ensures that whenever we receive a
stackbar_manager::Notification any stackbars not associated with the
current workspace on each monitor are destroyed.

fix #838
  • Loading branch information
LGUG2Z committed May 21, 2024
1 parent 0dc17e9 commit 69680b4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions komorebi/src/stackbar_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,27 @@ pub fn handle_notifications(wm: Arc<Mutex<WindowManager>>) -> color_eyre::Result
continue 'receiver;
}

// Destroy any stackbars not associated with the focused workspace
let container_ids = ws
.containers()
.iter()
.map(|c| c.id().clone())
.collect::<Vec<_>>();

let mut to_remove = vec![];
for (id, stackbar) in stackbars.iter() {
if stackbars_monitors.get(id).copied().unwrap_or_default() == monitor_idx
&& !container_ids.contains(id)
{
stackbar.destroy()?;
to_remove.push(id.clone());
}
}

for id in &to_remove {
stackbars.remove(id);
}

let container_padding = ws
.container_padding()
.unwrap_or_else(|| DEFAULT_CONTAINER_PADDING.load_consume());
Expand Down

0 comments on commit 69680b4

Please sign in to comment.