fix: ensure TagEmpty event fires

This commit is contained in:
atagen 2025-06-23 12:41:01 +10:00
parent 60a7f4ddff
commit 18d349c11f

View File

@ -250,13 +250,12 @@ impl NiriTag {
}
};
let rm_tag = async |tx: Sender<TagEvent>, windows: &HashMap<u64, u8>, wid, old_tag| {
if old_tag != 0
&& windows
.iter()
.filter(|(w, tag)| **tag == old_tag && **w != wid)
.collect::<Vec<(_, _)>>()
.is_empty()
{
tracing::debug!("removing tag {}", wid);
let same_tagged = windows
.iter()
.filter(|(w, tag)| **tag == old_tag && **w != wid)
.count();
if same_tagged == 0 && old_tag != 0 {
send_event(tx, TagEvent::TagEmpty(old_tag)).await;
}
};