From 6a6fc56da086081456f9e60d9916a94894bd4c3a Mon Sep 17 00:00:00 2001 From: Ryan Brue Date: Tue, 13 Aug 2024 16:43:52 -0500 Subject: [PATCH] feat: set RYANABX_SHELL_DESKTOP to set the desktop session, defaults to XDG_CURRENT_DESKTOP --- src/compositor/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compositor/mod.rs b/src/compositor/mod.rs index 900bd75..b5fbe3a 100644 --- a/src/compositor/mod.rs +++ b/src/compositor/mod.rs @@ -13,7 +13,12 @@ pub enum WaylandMessage { } pub(crate) fn wayland_subscription() -> iced::Subscription { - match env::var("XDG_CURRENT_DESKTOP").as_deref() { + // set the environment variable RYANABX_SHELL_DESKTOP to set which desktop session should be inferred + let current_compositor = match env::var("RYANABX_SHELL_DESKTOP") { + Ok(val) => Ok(val), + _ => env::var("XDG_CURRENT_DESKTOP"), // fall back on XDG_CURRENT_DESKTOP if not set + }; + match current_compositor.as_deref() { Ok("COSMIC") => cosmic_comp::wayland_subscription().map(WaylandMessage::CosmicComp), _ => panic!("Unsupported desktop"), }