fix: keep tokio runtime available for compositor

This commit is contained in:
Lionel DARNIS 2026-05-24 16:08:29 +02:00
parent 934db82775
commit 56230f0ade
3 changed files with 11 additions and 0 deletions

1
Cargo.lock generated
View file

@ -1049,6 +1049,7 @@ dependencies = [
"smithay-egui",
"thiserror 2.0.18",
"tiny-skia",
"tokio",
"tracing",
"tracing-journald",
"tracing-subscriber",

View file

@ -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"

View file

@ -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);