chore: use dbus config subscription for app list

This commit is contained in:
Ashley Wulber 2024-01-18 18:18:27 -05:00 committed by Ashley Wulber
parent 6851d9de54
commit ebe688c747
9 changed files with 327 additions and 353 deletions

615
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -44,10 +44,10 @@ tracing-log = "0.2.0"
lto = "thin"
# lto = "fat"
# [patch."https://github.com/pop-os/cosmic-time"]
# cosmic-time = { path = "../cosmic-time" }
# [patch."https://github.com/pop-os/libcosmic"]
# libcosmic = { path = "../libcosmic" }
# cosmic-config = { path = "../libcosmic/cosmic-config" }
[patch."https://github.com/pop-os/cosmic-time"]
cosmic-time = { path = "../cosmic-time" }
[patch."https://github.com/pop-os/libcosmic"]
libcosmic = { path = "../libcosmic" }
cosmic-config = { path = "../libcosmic/cosmic-config" }
[patch."https://github.com/Smithay/client-toolkit"]
sctk = { git = "https://github.com/smithay/client-toolkit//", package = "smithay-client-toolkit", rev = "e63ab5f" }

View file

@ -1158,16 +1158,11 @@ impl cosmic::Application for CosmicAppList {
_ => None,
}),
rectangle_tracker_subscription(0).map(|update| Message::Rectangle(update.1)),
cosmic_config::config_subscription(0, Cow::from(APP_ID), 1).map(|(_, config)| {
match config {
Ok(config) => Message::ConfigUpdated(config),
Err((errors, config)) => {
for error in errors {
log::error!("{:?}", error);
}
Message::ConfigUpdated(config)
}
self.core.watch_config(APP_ID).map(|u| {
for err in u.errors {
log::error!("Error watching config: {}", err);
}
Message::ConfigUpdated(u.config)
}),
])
}

View file

@ -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),

View file

@ -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,

View file

@ -8,8 +8,8 @@ edition = "2021"
libcosmic.workspace = true
cctk.workspace = true
cosmic-protocols.workspace = true
nix = "0.26.1"
log = "0.4"
nix = "0.27.1"
tracing = "0.1"
tracing-subscriber.workspace = true
tracing-log.workspace = true
once_cell = "1.9"

View file

@ -5,8 +5,7 @@ mod localize;
mod wayland;
mod wayland_subscription;
use config::APP_ID;
use log::info;
use tracing::info;
use localize::localize;

2
debian/control vendored
View file

@ -5,7 +5,7 @@ Maintainer: system76 <info@system76.com>
Build-Depends:
debhelper (>= 11),
debhelper-compat (= 11),
rustc (=1.73.0),
rustc (>=1.73.0),
cargo,
libdbus-1-dev,
libegl-dev,

View file

@ -1,2 +1,2 @@
[toolchain]
channel = "1.73"
channel = "1.75"