diff --git a/Cargo.lock b/Cargo.lock index 372604b1..97948805 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1049,6 +1049,7 @@ dependencies = [ "smithay-egui", "thiserror 2.0.18", "tiny-skia", + "tokio", "tracing", "tracing-journald", "tracing-subscriber", diff --git a/Cargo.toml b/Cargo.toml index 3010ff90..6e3b03a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,6 +77,7 @@ xdg = "^3.0" xdg-user = "0.2.1" xkbcommon = "0.9" zbus = "5.14.0" +tokio = { version = "1", features = ["rt-multi-thread"] } profiling = { version = "1.0" } rustix = { version = "1.1.4", features = ["process"] } rand = "0.10" diff --git a/src/main.rs b/src/main.rs index 7ae05991..ffa37236 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,15 @@ // SPDX-License-Identifier: GPL-3.0-only fn main() { + // libcosmic-yoda enables zbus' `tokio` feature, so zbus 5.14 expects an + // ambient Tokio runtime via Handle::current(). cosmic-comp's loop is not + // async, so hold a runtime guard for the lifetime of run(). + let runtime = tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build() + .expect("failed to build tokio runtime"); + let _guard = runtime.enter(); + if let Err(err) = cosmic_comp::run(Default::default()) { tracing::error!("Error occured in main(): {}", err); std::process::exit(1);