fix(tray): (maybe?) sometimes bus name is taken

No idea if this fix actually does anything but no harm in it I guess.
This commit is contained in:
Jake Stanger 2023-06-17 21:29:33 +01:00
parent b3b96673b0
commit de98cf3dae
No known key found for this signature in database
GPG Key ID: C51FC8F9CB0BEA61

View File

@ -11,6 +11,7 @@ use stray::StatusNotifierWatcher;
use tokio::spawn;
use tokio::sync::{broadcast, mpsc};
use tracing::{debug, error, trace};
use crate::unique_id::get_unique_usize;
type Tray = BTreeMap<String, (Box<StatusNotifierItem>, Option<TrayMenu>)>;
@ -24,11 +25,13 @@ pub struct TrayEventReceiver {
impl TrayEventReceiver {
async fn new() -> stray::error::Result<Self> {
let id = format!("ironbar-{}", get_unique_usize());
let (tx, rx) = mpsc::channel(16);
let (b_tx, b_rx) = broadcast::channel(16);
let tray = StatusNotifierWatcher::new(rx).await?;
let mut host = tray.create_notifier_host("ironbar").await?;
let mut host = tray.create_notifier_host(&id).await?;
let tray = Arc::new(Mutex::new(BTreeMap::new()));