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