status-area: Seperate daemon for status notifier daemon

This allows the applet to be restarted on panel configuration changes
without replacing the daemon, or having races between different applet
instances trying to run the watcher.

Otherwise, this should behave similarly to the existing version.

Should fix https://github.com/pop-os/cosmic-panel/issues/284.
This commit is contained in:
Ian Douglas Scott 2025-12-09 18:41:37 -08:00
parent fe0e4bf409
commit aa438821b9
9 changed files with 310 additions and 4 deletions

View file

@ -9,7 +9,7 @@ use futures::{StreamExt, stream};
use crate::subscriptions::status_notifier_item::StatusNotifierItem;
mod client;
mod server;
pub(crate) mod server;
#[derive(Clone, Debug)]
pub enum Event {
@ -51,7 +51,9 @@ async fn connect() -> zbus::Result<(zbus::Connection, client::EventStream)> {
let connection = zbus::Connection::session().await?;
// Start `StatusNotifierWatcher` service, if there isn't one running already
server::create_service(&connection).await?;
if let Err(err) = crate::status_notifier_watcher::cosmic_register(&connection).await {
eprintln!("Failed to start status notifier watcher: {}", err);
}
// Connect client and listen for registered/unregistered
let stream = client::watch(&connection).await?;