From be418fde284e39ba518da4eebff70312c7c06443 Mon Sep 17 00:00:00 2001 From: Ron Waldon-Howe Date: Wed, 10 Jan 2024 11:08:31 +1100 Subject: [PATCH] fix: start systemd target _after_ cosmic-comp is ready --- src/main.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 92bd856..e9d95f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,13 +111,9 @@ async fn start( session_tx, ) .wrap_err("failed to start compositor")?; - sleep(Duration::from_millis(2000)).await; - systemd::start_systemd_target().await; - // Always stop the target when the process exits or panics. - scopeguard::defer! { - systemd::stop_systemd_target(); - } + // TODO: do we still need to sleep here if we are waiting for cosmic-comp's environment variables? + sleep(Duration::from_millis(2000)).await; process_manager .start(Process::new().with_executable("cosmic-settings-daemon")) @@ -129,7 +125,16 @@ async fn start( .expect("failed to receive environmental variables") .into_iter() .collect::>(); - info!("got environmental variables: {:?}", env_vars); + info!( + "got environmental variables from cosmic-comp: {:?}", + env_vars + ); + + systemd::start_systemd_target().await; + // Always stop the target when the process exits or panics. + scopeguard::defer! { + systemd::stop_systemd_target(); + } let (panel_notifications_fd, daemon_notifications_fd) = notifications::create_socket().expect("Failed to create notification socket");