chore: use dbus config subscription for app list
This commit is contained in:
parent
6851d9de54
commit
ebe688c747
9 changed files with 327 additions and 353 deletions
|
|
@ -43,7 +43,8 @@ mod pulse;
|
|||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
pub fn main() -> cosmic::iced::Result {
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn main() -> cosmic::iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
let _ = tracing_log::LogTracer::init();
|
||||
|
||||
|
|
@ -560,19 +561,11 @@ impl cosmic::Application for Audio {
|
|||
self.timeline
|
||||
.as_subscription()
|
||||
.map(|(_, now)| Message::Frame(now)),
|
||||
cosmic::cosmic_config::config_subscription(
|
||||
0,
|
||||
Self::APP_ID.into(),
|
||||
AudioAppletConfig::version(),
|
||||
)
|
||||
.map(|(_, res)| match res {
|
||||
Ok(c) => Message::ConfigChanged(c),
|
||||
Err((errs, c)) => {
|
||||
for err in errs {
|
||||
tracing::error!("Error loading config: {}", err);
|
||||
}
|
||||
Message::ConfigChanged(c)
|
||||
self.core.watch_config(Self::APP_ID.into()).map(|u| {
|
||||
for err in u.errors {
|
||||
tracing::error!(?err, "Error watching config");
|
||||
}
|
||||
Message::ConfigChanged(u.config)
|
||||
}),
|
||||
mpris_subscription::mpris_subscription(0).map(Message::Mpris),
|
||||
activation_token_subscription(0).map(Message::Token),
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ impl PulseHandle {
|
|||
.send(Message::SetDefaultSink(sink))
|
||||
.await
|
||||
{
|
||||
tracing::error!("ERROR! {:?}", err);
|
||||
tracing::error!("ERROR! {}", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Err(_) => Self::send_disconnected(&from_pulse_send).await,
|
||||
|
|
@ -213,7 +214,8 @@ impl PulseHandle {
|
|||
.send(Message::SetDefaultSource(source))
|
||||
.await
|
||||
{
|
||||
tracing::error!("ERROR! {:?}", err);
|
||||
tracing::error!("ERROR! {}", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
|
|
@ -232,7 +234,8 @@ impl PulseHandle {
|
|||
if let Err(err) =
|
||||
from_pulse_send.send(Message::SetSinks(sinks)).await
|
||||
{
|
||||
tracing::error!("ERROR! {:?}", err);
|
||||
tracing::error!("ERROR! {}", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Err(_) => Self::send_disconnected(&from_pulse_send).await,
|
||||
|
|
@ -248,7 +251,8 @@ impl PulseHandle {
|
|||
if let Err(err) =
|
||||
from_pulse_send.send(Message::SetSources(sinks)).await
|
||||
{
|
||||
tracing::error!("ERROR! {:?}", err);
|
||||
tracing::error!("ERROR! {}", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Err(_) => Self::send_disconnected(&from_pulse_send).await,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue