From 519424d42f9b7733b97d432e8b79be5bec422370 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Fri, 1 Nov 2024 13:58:59 +0100 Subject: [PATCH] fix zbus executor ticking --- src/application.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/application.rs b/src/application.rs index f8fa5e0..b4c7f32 100644 --- a/src/application.rs +++ b/src/application.rs @@ -25,7 +25,6 @@ mod imp { window.present(); glib::spawn_future_local(async move { - // run this in glib's main loop let conn = zbus::connection::Builder::session() .expect("could not connect to the session bus") .internal_executor(false) @@ -33,6 +32,17 @@ mod imp { .await .expect("could not build connection to the session bus"); + // run this in glib's main loop + glib::spawn_future_local(glib::clone!( + #[strong] + conn, + async move { + loop { + conn.executor().tick().await; + } + } + )); + crate::Mpris::setup(conn.object_server(), &window) .await .expect("could not serve mpris"); @@ -49,10 +59,6 @@ mod imp { conn.request_name("org.mpris.MediaPlayer2.audrey") .await .expect("could not register name in session bus"); - - loop { - conn.executor().tick().await; - } }); } Some(win) => win.present(),