From 4ad01331e0fab3679a4b7f2571e2c0e4d350f1b6 Mon Sep 17 00:00:00 2001 From: Lucy Date: Mon, 7 Mar 2022 15:04:14 -0500 Subject: [PATCH] Perhaps we'll use relm4 for audio? --- Cargo.lock | 51 ++++++++++++++++++++++++- applets/cosmic-applet-audio/Cargo.toml | 7 ++-- applets/cosmic-applet-audio/src/main.rs | 10 +++++ 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3c4e2703..937e5d15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -241,7 +241,8 @@ dependencies = [ "gtk4", "libcosmic-widgets", "once_cell", - "relm4-macros 0.4.2", + "pulsectl-rs", + "relm4", "tokio", ] @@ -1013,6 +1014,33 @@ dependencies = [ "winapi", ] +[[package]] +name = "libpulse-binding" +version = "2.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17be42160017e0ae993c03bfdab4ecb6f82ce3f8d515bd8da8fdf18d10703663" +dependencies = [ + "bitflags", + "libc", + "libpulse-sys", + "num-derive", + "num-traits", + "winapi", +] + +[[package]] +name = "libpulse-sys" +version = "1.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "991e6bd0efe2a36e6534e136e7996925e4c1a8e35b7807fe533f2beffff27c30" +dependencies = [ + "libc", + "num-derive", + "num-traits", + "pkg-config", + "winapi", +] + [[package]] name = "lock_api" version = "0.4.6" @@ -1123,6 +1151,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -1378,6 +1417,15 @@ dependencies = [ "libc", ] +[[package]] +name = "pulsectl-rs" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06a988bceed1981b2c5fc4a3da0e4e073fdaff8e6bd022b089f54bc573dc3cfc" +dependencies = [ + "libpulse-binding", +] + [[package]] name = "quote" version = "1.0.15" @@ -1456,6 +1504,7 @@ dependencies = [ "gtk4", "log", "once_cell", + "relm4-macros 0.4.1", "tokio", ] diff --git a/applets/cosmic-applet-audio/Cargo.toml b/applets/cosmic-applet-audio/Cargo.toml index fd06ad06..3b9af854 100644 --- a/applets/cosmic-applet-audio/Cargo.toml +++ b/applets/cosmic-applet-audio/Cargo.toml @@ -7,7 +7,8 @@ license = "LGPL-3.0-or-later" [dependencies] futures-util = "0.3.21" gtk4 = "0.4.6" -once_cell = "1.10.0" -relm4-macros = "0.4.2" -tokio = { version = "1.17.0", features = ["full"] } libcosmic-widgets = { git = "https://github.com/pop-os/libcosmic", branch = "lucy/widgets" } +once_cell = "1.10.0" +pulsectl-rs = "0.3.2" +relm4 = { git = "https://github.com/AaronErhardt/relm4", branch = "new-approach", features = ["macros"] } +tokio = { version = "1.17.0", features = ["full"] } diff --git a/applets/cosmic-applet-audio/src/main.rs b/applets/cosmic-applet-audio/src/main.rs index e7a11a96..534853b9 100644 --- a/applets/cosmic-applet-audio/src/main.rs +++ b/applets/cosmic-applet-audio/src/main.rs @@ -1,3 +1,13 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later + +#[macro_use] +extern crate relm4; + +use once_cell::sync::Lazy; +use tokio::runtime::Runtime; + +static RT: Lazy = Lazy::new(|| Runtime::new().expect("failed to build tokio runtime")); + fn main() { println!("Hello, world!"); }