diff --git a/src/platform/mod.rs b/src/platform/mod.rs index 66ee7af..7465942 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -6,7 +6,6 @@ pub enum Platform { Unknown, } - pub fn get_platform() -> Platform { if platform_is_hyprland() { return Platform::Hyprland; @@ -29,7 +28,10 @@ fn platform_is_x11() -> bool { Command::new("printenv") .arg("XDG_SESSION_TYPE") .output() - .map(|info| info.status.success() && String::from_utf8_lossy(&info.stdout) == "x11") + .map(|info| { + info.status.success() + && String::from_utf8_lossy(&info.stdout).replace("\n", "") == "x11" + }) .unwrap_or(false) } @@ -45,4 +47,5 @@ fn platform_is_x11() -> bool { // https://unix.stackexchange.com/questions/706477/is-there-a-way-to-get-list-of-windows-on-kde-wayland // for gnome -// https://github.com/ActivityWatch/aw-watcher-window/pull/46/files \ No newline at end of file +// https://github.com/ActivityWatch/aw-watcher-window/pull/46/files +