1use std::env;
2
3pub fn is_gnome() -> bool {
4 if let Ok(de) = std::env::var("XDG_CURRENT_DESKTOP") {
5 de.to_lowercase().contains("gnome")
6 } else {
7 false
8 }
9}
10
11pub fn is_wayland() -> bool {
12 std::env::var("WAYLAND_DISPLAY").is_ok()
13 && std::env::var("XDG_SESSION_TYPE")
14 .unwrap_or("".into())
15 .to_lowercase()
16 .contains("wayland")
17}
18
19pub fn is_x11() -> bool {
20 return env::var("WAYLAND_DISPLAY").is_err()
21 && env::var_os("XDG_SESSION_TYPE").unwrap_or("".into()) == "x11";
22}