hotfix: make WM fetching more cross-platform capable

This commit is contained in:
Muhammad Nauman Raza 2024-03-24 20:28:20 +00:00
parent 923fa514e5
commit f42f29d2e8
No known key found for this signature in database
GPG key ID: 31BC90D626D2DBBE

View file

@ -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();
}