fix: logging and use dbus config subscription in audio applet

This commit is contained in:
Ashley Wulber 2024-01-18 18:16:37 -05:00 committed by Ashley Wulber
parent 85e4e65eb8
commit 6851d9de54
20 changed files with 63 additions and 139 deletions

126
Cargo.lock generated
View file

@ -410,17 +410,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
@ -772,7 +761,6 @@ dependencies = [
"log",
"nix 0.26.4",
"once_cell",
"pretty_env_logger 0.5.0",
"rand",
"ron",
"rust-embed 6.8.1",
@ -780,28 +768,30 @@ dependencies = [
"serde",
"shlex",
"tokio",
"tracing-log",
"tracing-subscriber",
"url",
"xdg",
]
[[package]]
name = "cosmic-applet-audio"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"cosmic-time",
"i18n-embed 0.13.9",
"i18n-embed-fl 0.6.7",
"icon-loader",
"libcosmic",
"libpulse-binding",
"libpulse-glib-binding",
"mpris2-zbus",
"pretty_env_logger 0.4.0",
"rust-embed 6.8.1",
"rust-embed-utils 7.8.1",
"serde",
"tokio",
"tracing",
"tracing-log",
"tracing-subscriber",
"url",
"zbus",
]
@ -817,10 +807,11 @@ dependencies = [
"libcosmic",
"log",
"once_cell",
"pretty_env_logger 0.5.0",
"rust-embed 6.8.1",
"tokio",
"tracing",
"tracing-log",
"tracing-subscriber",
"zbus",
]
@ -839,11 +830,12 @@ dependencies = [
"libcosmic",
"log",
"once_cell",
"pretty_env_logger 0.5.0",
"rand",
"rust-embed 6.8.1",
"slotmap",
"tokio",
"tracing-log",
"tracing-subscriber",
]
[[package]]
@ -873,11 +865,12 @@ dependencies = [
"itertools 0.10.5",
"libcosmic",
"log",
"pretty_env_logger 0.5.0",
"rust-embed 6.8.1",
"rust-embed-utils 7.8.1",
"slotmap",
"tokio",
"tracing-log",
"tracing-subscriber",
"zbus",
]
@ -900,6 +893,7 @@ dependencies = [
"sendfd",
"tokio",
"tracing",
"tracing-log",
"tracing-subscriber",
"url",
"zbus",
@ -965,7 +959,7 @@ dependencies = [
[[package]]
name = "cosmic-applet-workspaces"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"anyhow",
"cosmic-client-toolkit",
@ -977,8 +971,9 @@ dependencies = [
"log",
"nix 0.26.4",
"once_cell",
"pretty_env_logger 0.5.0",
"rust-embed 6.8.1",
"tracing-log",
"tracing-subscriber",
"xdg",
]
@ -1633,32 +1628,6 @@ dependencies = [
"syn 2.0.40",
]
[[package]]
name = "env_logger"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [
"atty",
"humantime 1.3.0",
"log",
"regex",
"termcolor",
]
[[package]]
name = "env_logger"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
dependencies = [
"humantime 2.1.0",
"is-terminal",
"log",
"regex",
"termcolor",
]
[[package]]
name = "equivalent"
version = "1.0.1"
@ -2425,15 +2394,6 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.3.3"
@ -2452,21 +2412,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
[[package]]
name = "humantime"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
dependencies = [
"quick-error",
]
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "i18n-config"
version = "0.4.6"
@ -2909,7 +2854,7 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
"hermit-abi 0.3.3",
"hermit-abi",
"libc",
"windows-sys 0.48.0",
]
@ -2920,17 +2865,6 @@ version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c"
[[package]]
name = "is-terminal"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi 0.3.3",
"rustix 0.38.28",
"windows-sys 0.48.0",
]
[[package]]
name = "itertools"
version = "0.10.5"
@ -3611,7 +3545,7 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi 0.3.3",
"hermit-abi",
"libc",
]
@ -3973,26 +3907,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
[[package]]
name = "pretty_env_logger"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"
dependencies = [
"env_logger 0.7.1",
"log",
]
[[package]]
name = "pretty_env_logger"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c"
dependencies = [
"env_logger 0.10.1",
"log",
]
[[package]]
name = "proc-macro-crate"
version = "1.3.1"
@ -4083,12 +3997,6 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "quick-error"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quick-xml"
version = "0.28.2"

View file

@ -37,6 +37,8 @@ libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = fa
] }
zbus = { version = "3.14", default-features = false, features = ["tokio"] }
tracing = "0.1"
tracing-subscriber = "0.3.18"
tracing-log = "0.2.0"
[profile.release]
lto = "thin"

View file

@ -14,7 +14,8 @@ futures = "0.3"
futures-util = "0.3"
once_cell = "1.9"
xdg = "2.4"
pretty_env_logger = "0.5"
tracing-subscriber.workspace = true
tracing-log.workspace = true
nix = "0.26"
shlex = "1.1.0"
anyhow = "1.0"

View file

@ -14,7 +14,8 @@ use crate::config::{APP_ID, VERSION};
fn main() -> cosmic::iced::Result {
// Initialize logger
pretty_env_logger::init();
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
info!("Iced Workspaces Applet ({})", APP_ID);
info!("Version: {}", VERSION);
// Prepare i18n

View file

@ -1,19 +1,19 @@
[package]
name = "cosmic-applet-audio"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
icon-loader = { version = "0.3.6", features = ["gtk"] }
libpulse-binding = "2.26.0"
libpulse-glib-binding = "2.25.0"
libpulse-binding = "2.28.1"
libpulse-glib-binding = "2.28.1"
tokio = { version = "1.20.1", features=["full"] }
libcosmic.workspace = true
cosmic-time.workspace = true
tracing = "0.1.40"
pretty_env_logger = "0.4.0"
tracing-subscriber.workspace = true
tracing-log.workspace = true
# Application i18n
i18n-embed = { version = "0.13", features = ["fluent-system", "desktop-requester"] }
i18n-embed-fl = "0.6"

View file

@ -40,12 +40,18 @@ use mpris_subscription::MprisUpdate;
mod config;
mod mpris_subscription;
mod pulse;
const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn main() -> cosmic::iced::Result {
pretty_env_logger::init();
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
// Prepare i18n
localize();
tracing::info!("Starting audio applet with version {VERSION}");
cosmic::applet::run::<Audio>(true, ())
}

View file

@ -11,7 +11,8 @@ tracing.workspace = true
futures = "0.3"
zbus.workspace = true
log = "0.4"
pretty_env_logger = "0.5"
tracing-subscriber.workspace = true
tracing-log.workspace = true
# Application i18n
i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] }
i18n-embed-fl = "0.6.4"

View file

@ -17,7 +17,8 @@ use crate::config::{PROFILE, VERSION};
fn main() -> cosmic::iced::Result {
// Initialize logger
pretty_env_logger::init();
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
info!("Iced Workspaces Applet ({})", APP_ID);
info!("Version: {} ({})", VERSION, PROFILE);

View file

@ -12,7 +12,8 @@ libcosmic.workspace = true
cosmic-time.workspace = true
futures = "0.3"
log = "0.4"
pretty_env_logger = "0.5"
tracing-subscriber.workspace = true
tracing-log.workspace = true
itertools = "0.10.3"
slotmap = "1.0.6"
tokio = { version = "1.15.0", features = ["full"] }

View file

@ -12,7 +12,8 @@ use crate::localize::localize;
fn main() -> cosmic::iced::Result {
// Initialize logger
pretty_env_logger::init();
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
info!("Iced Workspaces Applet ({})", APP_ID);
info!("Version: {} ({})", VERSION, PROFILE);

View file

@ -13,7 +13,8 @@ cosmic-time.workspace = true
futures = "0.3"
zbus.workspace = true
log = "0.4"
pretty_env_logger = "0.5"
tracing-subscriber.workspace = true
tracing-log.workspace = true
itertools = "0.10.3"
slotmap = "1.0.6"
tokio = { version = "1.15.0", features = ["full"] }

View file

@ -12,7 +12,8 @@ use crate::localize::localize;
fn main() -> cosmic::iced::Result {
// Initialize logger
pretty_env_logger::init();
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
info!("Iced Workspaces Applet ({})", APP_ID);
info!("Version: {} ({})", VERSION, PROFILE);

View file

@ -26,7 +26,8 @@ tracing = "0.1"
ron = "0.8"
sendfd = { version = "0.4", features = ["tokio"] }
bytemuck = "1"
tracing-subscriber = "0.3"
tracing-subscriber.workspace = true
tracing-log.workspace = true
zbus.workspace = true
# Application i18n
i18n-embed = { version = "0.13.4", features = [

View file

@ -32,6 +32,7 @@ use tracing::info;
#[tokio::main(flavor = "current_thread")]
pub async fn main() -> cosmic::iced::Result {
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
// Prepare i18n
localize::localize();

View file

@ -1,6 +1,6 @@
[package]
name = "cosmic-applet-workspaces"
version = "0.1.0"
version = "0.1.1"
authors = ["Ashley Wulber <ashley@system76.com>"]
edition = "2021"
@ -10,7 +10,8 @@ cctk.workspace = true
cosmic-protocols.workspace = true
nix = "0.26.1"
log = "0.4"
pretty_env_logger = "0.5"
tracing-subscriber.workspace = true
tracing-log.workspace = true
once_cell = "1.9"
futures = "0.3.21"
xdg = "2.4.0"

View file

@ -38,7 +38,6 @@ enum Message {
WorkspaceUpdate(WorkspacesUpdate),
WorkspacePressed(ObjectId),
WheelScrolled(ScrollDelta),
Errored,
}
impl cosmic::Application for IcedWorkspacesApplet {
@ -114,7 +113,6 @@ impl cosmic::Application for IcedWorkspacesApplet {
let _ = tx.try_send(WorkspaceEvent::Scroll(delta));
}
}
Message::Errored => {}
}
Command::none()
}

View file

@ -1,3 +1 @@
pub const APP_ID: &str = "com.system76.CosmicWorkspacesApplet";
pub const PROFILE: &str = "";
pub const VERSION: &str = "0.1.0";

View file

@ -10,16 +10,17 @@ use log::info;
use localize::localize;
use crate::{
components::app,
config::{PROFILE, VERSION},
};
use crate::components::app;
const VERSION: &str = env!("CARGO_PKG_VERSION");
fn main() -> cosmic::iced::Result {
// Initialize logger
pretty_env_logger::init();
info!("Iced Workspaces Applet ({})", APP_ID);
info!("Version: {} ({})", VERSION, PROFILE);
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
info!("Starting audio applet with version {VERSION}");
info!("Iced Workspaces Applet ({VERSION})");
// Prepare i18n
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.65),
rustc (=1.73.0),
cargo,
libdbus-1-dev,
libegl-dev,

View file

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