fix zbus executor ticking

This commit is contained in:
Erica Z 2024-11-01 13:58:59 +01:00
parent 286c0e552d
commit 519424d42f

View file

@ -25,7 +25,6 @@ mod imp {
window.present(); window.present();
glib::spawn_future_local(async move { glib::spawn_future_local(async move {
// run this in glib's main loop
let conn = zbus::connection::Builder::session() let conn = zbus::connection::Builder::session()
.expect("could not connect to the session bus") .expect("could not connect to the session bus")
.internal_executor(false) .internal_executor(false)
@ -33,6 +32,17 @@ mod imp {
.await .await
.expect("could not build connection to the session bus"); .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) crate::Mpris::setup(conn.object_server(), &window)
.await .await
.expect("could not serve mpris"); .expect("could not serve mpris");
@ -49,10 +59,6 @@ mod imp {
conn.request_name("org.mpris.MediaPlayer2.audrey") conn.request_name("org.mpris.MediaPlayer2.audrey")
.await .await
.expect("could not register name in session bus"); .expect("could not register name in session bus");
loop {
conn.executor().tick().await;
}
}); });
} }
Some(win) => win.present(), Some(win) => win.present(),