efernau/rot8

Finding PID of Xorg is not robust

Closed this issue · 1 comments

For instance, on my system (NixOS), the binary is called X and I need this patch to make this tool work:

diff --git a/src/main.rs b/src/main.rs
index 89724de..688faf2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -138,7 +138,7 @@ fn main() -> Result<(), String> {
         >= 1
     {
         Backend::Sway
-    } else if String::from_utf8(Command::new("pidof").arg("Xorg").output().unwrap().stdout)
+    } else if String::from_utf8(Command::new("pidof").arg("X").output().unwrap().stdout)
         .unwrap()
         .len()
         >= 1

Hi @NickHu, I have written a patch #34 to cover both cases X and Xorg.
Is the behavior normal that it is only called "X" in your case?
Do you provide your nixos package?