From 4c4037401437f8205f48f1068c4f7609b41b63be Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 31 Oct 2023 10:14:32 -0400 Subject: [PATCH] refactor(power): assume the session is Cosmic if a special case is not detected --- cosmic-applet-power/src/main.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cosmic-applet-power/src/main.rs b/cosmic-applet-power/src/main.rs index 7d74987f..3a580df1 100644 --- a/cosmic-applet-power/src/main.rs +++ b/cosmic-applet-power/src/main.rs @@ -413,18 +413,15 @@ async fn log_out() -> zbus::Result<()> { let session_type = std::env::var("XDG_CURRENT_DESKTOP").ok(); let connection = Connection::session().await?; match session_type.as_ref().map(|s| s.trim()) { - Some("pop:COSMIC") => { - let cosmic_session = CosmicSessionProxy::new(&connection).await?; - cosmic_session.exit().await?; - } Some("pop:GNOME") => { let manager_proxy = SessionManagerProxy::new(&connection).await?; manager_proxy.logout(0).await?; } - Some(desktop) => { - eprintln!("unknown XDG_CURRENT_DESKTOP: {desktop}") + // By default assume COSMIC + _ => { + let cosmic_session = CosmicSessionProxy::new(&connection).await?; + cosmic_session.exit().await?; } - None => {} } Ok(()) }