diff --git a/Cargo.lock b/Cargo.lock index bde4de8f..89e24e6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,7 +77,7 @@ dependencies = [ "futures-lite", "futures-util", "serde", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -475,7 +475,7 @@ dependencies = [ "enumflags2", "serde", "static_assertions", - "zbus", + "zbus 5.19.0", "zbus-lockstep", "zbus-lockstep-macros", "zbus_names", @@ -491,7 +491,7 @@ dependencies = [ "atspi-common", "atspi-proxies", "futures-lite", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -502,7 +502,7 @@ checksum = "d2eebcb9e7e76f26d0bcfd6f0295e1cd1e6f33bedbc5698a971db8dc43d7751c" dependencies = [ "atspi-common", "serde", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -2520,7 +2520,7 @@ dependencies = [ "tracing-subscriber", "uuid", "version", - "zbus", + "zbus 6.1.0", ] [[package]] @@ -4875,7 +4875,6 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "tracing", "windows-sys 0.61.2", ] @@ -6199,17 +6198,44 @@ dependencies = [ "rustix 1.1.6", "serde", "serde_repr", - "tokio", "tracing", "uds_windows", "uuid", "windows-sys 0.61.2", "winnow", - "zbus_macros", + "zbus_macros 5.19.0", "zbus_names", "zvariant", ] +[[package]] +name = "zbus" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcff5faa63a63d5b81051740f7382017f10b3440b3f401d97f0cf0b3b39c62d9" +dependencies = [ + "async-trait", + "bitflags 2.13.2", + "endi", + "futures-core", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.6", + "serde", + "serde_repr", + "socket2", + "tokio", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros 6.1.0", + "zbus_utils", + "zcheapstr", + "zruntime", +] + [[package]] name = "zbus-lockstep" version = "0.5.2" @@ -6249,6 +6275,18 @@ dependencies = [ "zvariant_utils", ] +[[package]] +name = "zbus_macros" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bba6e2bfe19571dc81b3e0be9f8daec6e5422db3e2eea2e766a859553e7bd37" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "zbus_utils", +] + [[package]] name = "zbus_names" version = "4.3.5" @@ -6260,6 +6298,19 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zbus_utils" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c27a055b114bd9fc3686e90f62bd1fe612d523fc5f620bac3b1d2f42d3f6cab8" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.9", + "winnow", +] + [[package]] name = "zbus_xml" version = "5.2.1" @@ -6367,6 +6418,16 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" +[[package]] +name = "zruntime" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc035df602243402949ddf3dcc5bcfad7edeb732dd49ec6e605431c4eca54ce" +dependencies = [ + "futures-core", + "futures-io", +] + [[package]] name = "zune-core" version = "0.5.3" diff --git a/komorebi/Cargo.toml b/komorebi/Cargo.toml index 7364bb17..d4428d44 100644 --- a/komorebi/Cargo.toml +++ b/komorebi/Cargo.toml @@ -36,7 +36,11 @@ tokio = { version = "1", features = [ tracing = { workspace = true } tracing-appender = { workspace = true } tracing-subscriber = { workspace = true } -zbus = { version = "5", default-features = false, features = ["tokio"] } +zbus = { version = "6", default-features = false, features = [ + "tokio", + "proxy", + "service", +] } futures-util = "0.3" [dev-dependencies] diff --git a/komorebi/src/kwin/hotkeys.rs b/komorebi/src/kwin/hotkeys.rs index b0c2c87c..88871387 100644 --- a/komorebi/src/kwin/hotkeys.rs +++ b/komorebi/src/kwin/hotkeys.rs @@ -106,8 +106,8 @@ use std::time::Duration; use std::time::Instant; use tokio::sync::mpsc; use zbus::Connection; +use zbus::OwnedObjectPath; use zbus::proxy::Proxy; -use zbus::zvariant::OwnedObjectPath; /// The name of komorebi's component in kglobalaccel. pub const COMPONENT: &str = "komorebi"; diff --git a/komorebi/src/kwin/mod.rs b/komorebi/src/kwin/mod.rs index a4eed240..6d16fec6 100644 --- a/komorebi/src/kwin/mod.rs +++ b/komorebi/src/kwin/mod.rs @@ -434,20 +434,20 @@ pub fn connect() -> eyre::Result> { } async fn start(shared: Arc) -> eyre::Result<()> { - let connection = zbus::connection::Builder::session()? - .name(SERVICE)? + let connection = zbus::connection::Builder::session() + .name(SERVICE) .serve_at( PATH, Events { shared: shared.clone(), }, - )? + ) .serve_at( POLL_PATH, Poll { shared: shared.clone(), }, - )? + ) .build() .await .map_err(|error| { @@ -675,9 +675,9 @@ async fn desktop_manager(shared: &Shared) -> eyre::Result> { let connection = shared.connection().await?; // uncached: a property read right after createDesktop must not return the list from before it Ok(zbus::proxy::Builder::new(&connection) - .destination("org.kde.KWin")? - .path("/VirtualDesktopManager")? - .interface("org.kde.KWin.VirtualDesktopManager")? + .destination("org.kde.KWin") + .path("/VirtualDesktopManager") + .interface("org.kde.KWin.VirtualDesktopManager") .cache_properties(CacheProperties::No) .build() .await?) diff --git a/komorebi/src/kwin/power.rs b/komorebi/src/kwin/power.rs index 2d1c467a..c2bb1f93 100644 --- a/komorebi/src/kwin/power.rs +++ b/komorebi/src/kwin/power.rs @@ -79,9 +79,9 @@ async fn screen_lock(session: Connection) { // KDE's lock screen says whether it is up, on KWin's name for the freedesktop interface let rule = MatchRule::builder() .msg_type(Type::Signal) - .interface("org.freedesktop.ScreenSaver")? - .member("ActiveChanged")? - .build(); + .interface("org.freedesktop.ScreenSaver") + .member("ActiveChanged") + .build()?; let mut stream = MessageStream::for_match_rule(rule, &session, None).await?; while let Some(message) = stream.next().await { @@ -113,10 +113,10 @@ async fn sleep(system: Connection) { let result = async { let rule = MatchRule::builder() .msg_type(Type::Signal) - .sender("org.freedesktop.login1")? - .interface("org.freedesktop.login1.Manager")? - .member("PrepareForSleep")? - .build(); + .sender("org.freedesktop.login1") + .interface("org.freedesktop.login1.Manager") + .member("PrepareForSleep") + .build()?; let mut stream = MessageStream::for_match_rule(rule, &system, None).await?; while let Some(message) = stream.next().await { diff --git a/komorebi/src/kwin/wallpaper.rs b/komorebi/src/kwin/wallpaper.rs index 0c88d8f4..6b84fcc6 100644 --- a/komorebi/src/kwin/wallpaper.rs +++ b/komorebi/src/kwin/wallpaper.rs @@ -25,9 +25,9 @@ use color_eyre::eyre; use std::collections::HashMap; use std::path::Path; use zbus::Connection; +use zbus::OwnedVariant; +use zbus::Variant; use zbus::proxy::Proxy; -use zbus::zvariant::OwnedValue; -use zbus::zvariant::Value; /// The Plasma shell's name on the session bus. const SHELL: &str = "org.kde.plasmashell"; @@ -75,7 +75,7 @@ fn screen_script(output: &str) -> String { /// Returns true if and only if the shell's answer about a screen's wallpaper is the picture at /// `url`, shown by [`PLUGIN`] with [`FILL_MODE`]. -fn shows(current: &HashMap, url: &str) -> bool { +fn shows(current: &HashMap, url: &str) -> bool { let text = |key: &str| { current .get(key) @@ -113,14 +113,14 @@ pub async fn apply(connection: &Connection, output: &str, path: &Path) -> eyre:: }; let url = file_url(path); - let current: HashMap = proxy.call("wallpaper", &(screen,)).await?; + let current: HashMap = proxy.call("wallpaper", &(screen,)).await?; if shows(¤t, &url) { return Ok(false); } - let mut parameters: HashMap<&str, Value<'_>> = HashMap::new(); - parameters.insert("Image", Value::from(url)); - parameters.insert("FillMode", Value::from(FILL_MODE)); + let mut parameters: HashMap<&str, Variant<'_>> = HashMap::new(); + parameters.insert("Image", Variant::from(url)); + parameters.insert("FillMode", Variant::from(FILL_MODE)); proxy .call_method("setWallpaper", &(PLUGIN, parameters, screen)) .await?; diff --git a/komorebi/tests/power.rs b/komorebi/tests/power.rs index 4d8547e6..47a30a10 100644 --- a/komorebi/tests/power.rs +++ b/komorebi/tests/power.rs @@ -40,9 +40,9 @@ impl Bus { } async fn connect(&self, name: Option<&str>) -> Connection { - let mut builder = zbus::connection::Builder::address(self.address.as_str()).unwrap(); + let mut builder = zbus::connection::Builder::address(self.address.as_str()); if let Some(name) = name { - builder = builder.name(name.to_string()).unwrap(); + builder = builder.name(name.to_string()); } builder.build().await.unwrap() }