chore: add debug flag + housekeeping
This commit is contained in:
parent
18d349c11f
commit
67e77c122f
4 changed files with 29 additions and 12 deletions
|
@ -158,7 +158,6 @@ impl NiriTag {
|
|||
Tag(tag) => {
|
||||
tracing::debug!("Changing tag {}", tag);
|
||||
let tag_visible = *self.tags.entry(tag).or_insert(true);
|
||||
tracing::debug!("Windows: {:?}", self.windows);
|
||||
let affected_windows: Vec<u64> = self
|
||||
.windows
|
||||
.iter()
|
||||
|
@ -239,7 +238,7 @@ impl NiriTag {
|
|||
})
|
||||
.detach();
|
||||
};
|
||||
let add_tag = async |tx: Sender<TagEvent>, windows: &HashMap<u64, u8>, t| {
|
||||
let add_tag_fire = async |tx: Sender<TagEvent>, windows: &HashMap<u64, u8>, t| {
|
||||
if windows
|
||||
.iter()
|
||||
.filter(|(_, tag)| **tag == t)
|
||||
|
@ -249,8 +248,7 @@ impl NiriTag {
|
|||
send_event(tx, TagEvent::TagOccupied(t)).await;
|
||||
}
|
||||
};
|
||||
let rm_tag = async |tx: Sender<TagEvent>, windows: &HashMap<u64, u8>, wid, old_tag| {
|
||||
tracing::debug!("removing tag {}", wid);
|
||||
let rm_tag_fire = async |tx: Sender<TagEvent>, windows: &HashMap<u64, u8>, wid, old_tag| {
|
||||
let same_tagged = windows
|
||||
.iter()
|
||||
.filter(|(w, tag)| **tag == old_tag && **w != wid)
|
||||
|
@ -293,7 +291,7 @@ impl NiriTag {
|
|||
self.windows.insert(wid, t);
|
||||
tracing::debug!("adding tag {} to {}", t, wid);
|
||||
let tx = self.ev_tx.clone();
|
||||
add_tag(tx, &self.windows, t).await;
|
||||
add_tag_fire(tx, &self.windows, t).await;
|
||||
Window(wid)
|
||||
}
|
||||
TagCmd::RemoveTagFromWin(_) => {
|
||||
|
@ -302,7 +300,7 @@ impl NiriTag {
|
|||
let old_tag = self.windows.insert(wid, 0).unwrap_or(0);
|
||||
tracing::debug!("resetting tag on {}", wid);
|
||||
let tx = self.ev_tx.clone();
|
||||
rm_tag(tx, &self.windows, wid, old_tag).await;
|
||||
rm_tag_fire(tx, &self.windows, wid, old_tag).await;
|
||||
Window(wid)
|
||||
}
|
||||
TagCmd::ToggleTagOnWin(t) => {
|
||||
|
@ -313,9 +311,9 @@ impl NiriTag {
|
|||
let toggle = if this_tag == t { 0 } else { t };
|
||||
let tx = self.ev_tx.clone();
|
||||
if toggle == 0 {
|
||||
rm_tag(tx, &self.windows, wid, this_tag).await;
|
||||
rm_tag_fire(tx, &self.windows, wid, this_tag).await;
|
||||
} else {
|
||||
add_tag(tx, &self.windows, t).await;
|
||||
add_tag_fire(tx, &self.windows, t).await;
|
||||
}
|
||||
tracing::debug!("toggling {} to tag {}", wid, toggle);
|
||||
self.windows.insert(wid, toggle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue