1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-01 18:51:04 +02:00

chore(system tray): add debug logging

This commit is contained in:
Jake Stanger 2023-04-16 19:55:17 +01:00
parent 1e1d65ae49
commit 8e99fd4d0f
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61

View file

@ -10,7 +10,7 @@ use stray::message::{NotifierItemCommand, NotifierItemMessage};
use stray::StatusNotifierWatcher; use stray::StatusNotifierWatcher;
use tokio::spawn; use tokio::spawn;
use tokio::sync::{broadcast, mpsc}; use tokio::sync::{broadcast, mpsc};
use tracing::error; use tracing::{debug, error, trace};
type Tray = BTreeMap<String, (Box<StatusNotifierItem>, Option<TrayMenu>)>; type Tray = BTreeMap<String, (Box<StatusNotifierItem>, Option<TrayMenu>)>;
@ -38,6 +38,8 @@ impl TrayEventReceiver {
spawn(async move { spawn(async move {
while let Ok(message) = host.recv().await { while let Ok(message) = host.recv().await {
trace!("Received message: {message:?} ");
send!(b_tx, message.clone()); send!(b_tx, message.clone());
let mut tray = lock!(tray); let mut tray = lock!(tray);
match message { match message {
@ -46,9 +48,11 @@ impl TrayEventReceiver {
item, item,
menu, menu,
} => { } => {
debug!("Adding item with address '{address}'");
tray.insert(address, (item, menu)); tray.insert(address, (item, menu));
} }
NotifierItemMessage::Remove { address } => { NotifierItemMessage::Remove { address } => {
debug!("Removing item with address '{address}'");
tray.remove(&address); tray.remove(&address);
} }
} }