fix: clean up tag toggling event code
This commit is contained in:
parent
091ee4d926
commit
6eb2e5fd9c
@ -305,14 +305,14 @@ impl NiriTag {
|
||||
ChangeTag(t)
|
||||
}
|
||||
TagCmd::ToggleTag(t) => {
|
||||
let visible = *self.tags.entry(t).or_insert(false);
|
||||
if visible {
|
||||
let new_state = !*self.tags.entry(t).or_insert(false);
|
||||
if new_state {
|
||||
send_event(self.ev_tx.clone(), TagEvent::TagEnabled(t)).await;
|
||||
} else {
|
||||
send_event(self.ev_tx.clone(), TagEvent::TagDisabled(t)).await;
|
||||
}
|
||||
tracing::debug!("toggling tag {} to {}", t, !visible);
|
||||
self.tags.insert(t, !visible);
|
||||
tracing::debug!("toggling tag {} to {}", t, new_state);
|
||||
self.tags.insert(t, new_state);
|
||||
ChangeTag(t)
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user