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
615
Cargo.lock
generated
615
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
10
Cargo.toml
10
Cargo.toml
|
|
@ -44,10 +44,10 @@ tracing-log = "0.2.0"
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
# lto = "fat"
|
# lto = "fat"
|
||||||
|
|
||||||
# [patch."https://github.com/pop-os/cosmic-time"]
|
[patch."https://github.com/pop-os/cosmic-time"]
|
||||||
# cosmic-time = { path = "../cosmic-time" }
|
cosmic-time = { path = "../cosmic-time" }
|
||||||
# [patch."https://github.com/pop-os/libcosmic"]
|
[patch."https://github.com/pop-os/libcosmic"]
|
||||||
# libcosmic = { path = "../libcosmic" }
|
libcosmic = { path = "../libcosmic" }
|
||||||
# cosmic-config = { path = "../libcosmic/cosmic-config" }
|
cosmic-config = { path = "../libcosmic/cosmic-config" }
|
||||||
[patch."https://github.com/Smithay/client-toolkit"]
|
[patch."https://github.com/Smithay/client-toolkit"]
|
||||||
sctk = { git = "https://github.com/smithay/client-toolkit//", package = "smithay-client-toolkit", rev = "e63ab5f" }
|
sctk = { git = "https://github.com/smithay/client-toolkit//", package = "smithay-client-toolkit", rev = "e63ab5f" }
|
||||||
|
|
|
||||||
|
|
@ -1158,16 +1158,11 @@ impl cosmic::Application for CosmicAppList {
|
||||||
_ => None,
|
_ => None,
|
||||||
}),
|
}),
|
||||||
rectangle_tracker_subscription(0).map(|update| Message::Rectangle(update.1)),
|
rectangle_tracker_subscription(0).map(|update| Message::Rectangle(update.1)),
|
||||||
cosmic_config::config_subscription(0, Cow::from(APP_ID), 1).map(|(_, config)| {
|
self.core.watch_config(APP_ID).map(|u| {
|
||||||
match config {
|
for err in u.errors {
|
||||||
Ok(config) => Message::ConfigUpdated(config),
|
log::error!("Error watching config: {}", err);
|
||||||
Err((errors, config)) => {
|
|
||||||
for error in errors {
|
|
||||||
log::error!("{:?}", error);
|
|
||||||
}
|
|
||||||
Message::ConfigUpdated(config)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Message::ConfigUpdated(u.config)
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ mod pulse;
|
||||||
|
|
||||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
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();
|
tracing_subscriber::fmt::init();
|
||||||
let _ = tracing_log::LogTracer::init();
|
let _ = tracing_log::LogTracer::init();
|
||||||
|
|
||||||
|
|
@ -560,19 +561,11 @@ impl cosmic::Application for Audio {
|
||||||
self.timeline
|
self.timeline
|
||||||
.as_subscription()
|
.as_subscription()
|
||||||
.map(|(_, now)| Message::Frame(now)),
|
.map(|(_, now)| Message::Frame(now)),
|
||||||
cosmic::cosmic_config::config_subscription(
|
self.core.watch_config(Self::APP_ID.into()).map(|u| {
|
||||||
0,
|
for err in u.errors {
|
||||||
Self::APP_ID.into(),
|
tracing::error!(?err, "Error watching config");
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
Message::ConfigChanged(u.config)
|
||||||
}),
|
}),
|
||||||
mpris_subscription::mpris_subscription(0).map(Message::Mpris),
|
mpris_subscription::mpris_subscription(0).map(Message::Mpris),
|
||||||
activation_token_subscription(0).map(Message::Token),
|
activation_token_subscription(0).map(Message::Token),
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,8 @@ impl PulseHandle {
|
||||||
.send(Message::SetDefaultSink(sink))
|
.send(Message::SetDefaultSink(sink))
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
tracing::error!("ERROR! {:?}", err);
|
tracing::error!("ERROR! {}", err);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => Self::send_disconnected(&from_pulse_send).await,
|
Err(_) => Self::send_disconnected(&from_pulse_send).await,
|
||||||
|
|
@ -213,7 +214,8 @@ impl PulseHandle {
|
||||||
.send(Message::SetDefaultSource(source))
|
.send(Message::SetDefaultSource(source))
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
tracing::error!("ERROR! {:?}", err);
|
tracing::error!("ERROR! {}", err);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -232,7 +234,8 @@ impl PulseHandle {
|
||||||
if let Err(err) =
|
if let Err(err) =
|
||||||
from_pulse_send.send(Message::SetSinks(sinks)).await
|
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,
|
Err(_) => Self::send_disconnected(&from_pulse_send).await,
|
||||||
|
|
@ -248,7 +251,8 @@ impl PulseHandle {
|
||||||
if let Err(err) =
|
if let Err(err) =
|
||||||
from_pulse_send.send(Message::SetSources(sinks)).await
|
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,
|
Err(_) => Self::send_disconnected(&from_pulse_send).await,
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ edition = "2021"
|
||||||
libcosmic.workspace = true
|
libcosmic.workspace = true
|
||||||
cctk.workspace = true
|
cctk.workspace = true
|
||||||
cosmic-protocols.workspace = true
|
cosmic-protocols.workspace = true
|
||||||
nix = "0.26.1"
|
nix = "0.27.1"
|
||||||
log = "0.4"
|
tracing = "0.1"
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
tracing-log.workspace = true
|
tracing-log.workspace = true
|
||||||
once_cell = "1.9"
|
once_cell = "1.9"
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ mod localize;
|
||||||
mod wayland;
|
mod wayland;
|
||||||
mod wayland_subscription;
|
mod wayland_subscription;
|
||||||
|
|
||||||
use config::APP_ID;
|
use tracing::info;
|
||||||
use log::info;
|
|
||||||
|
|
||||||
use localize::localize;
|
use localize::localize;
|
||||||
|
|
||||||
|
|
|
||||||
2
debian/control
vendored
2
debian/control
vendored
|
|
@ -5,7 +5,7 @@ Maintainer: system76 <info@system76.com>
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
debhelper (>= 11),
|
debhelper (>= 11),
|
||||||
debhelper-compat (= 11),
|
debhelper-compat (= 11),
|
||||||
rustc (=1.73.0),
|
rustc (>=1.73.0),
|
||||||
cargo,
|
cargo,
|
||||||
libdbus-1-dev,
|
libdbus-1-dev,
|
||||||
libegl-dev,
|
libegl-dev,
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.73"
|
channel = "1.75"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue