Skip to content

Commit

Permalink
Handle newline in X11 env check
Browse files Browse the repository at this point in the history
  • Loading branch information
shiro committed Feb 26, 2024
1 parent e90118c commit 00a01ba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub enum Platform {
Unknown,
}


pub fn get_platform() -> Platform {
if platform_is_hyprland() {
return Platform::Hyprland;
Expand All @@ -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)
}

Expand All @@ -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
// https://github.com/ActivityWatch/aw-watcher-window/pull/46/files

0 comments on commit 00a01ba

Please sign in to comment.