From 3367dcd576e21cf76a9ca0b79205dd9db545cde2 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Sun, 24 Mar 2024 20:28:20 +0000 Subject: [PATCH] hotfix: make WM fetching more cross-platform capable --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 66b1722..6636039 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,13 @@ fn main() { if cfg!(windows) { wm = "Aero".to_string(); } else if cfg!(unix) { - wm = var("XDG_CURRENT_DESKTOP").unwrap(); + let xdg_current_desktop = var("XDG_CURRENT_DESKTOP"); + let desktop = desktop_env().to_string(); + if !xdg_current_desktop.is_err() && (desktop != "Unknown: Unknown") { + wm = desktop; + } else { + wm = xdg_current_desktop.unwrap(); + } } else { wm = "N/A".to_string(); }