gardesk/tarmac / 676b3a4

Browse files

find ers binary next to tarmac before falling back to PATH

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
676b3a44b677d9ea6ff8401ae9c2184f4b64ab77
Parents
ee6e68b
Tree
3105b5b

1 changed file

StatusFile+-
M tarmac/src/platform/border.rs 10 2
tarmac/src/platform/border.rsmodified
@@ -67,13 +67,21 @@ impl BorderManager {
6767
     }
6868
 
6969
     /// Spawn ers with current settings. Kills any existing instance first.
70
+    /// Looks for ers next to the tarmac binary first, then falls back to PATH.
7071
     pub fn spawn(&mut self) {
7172
         self.kill();
7273
         if !self.is_enabled() { return; }
7374
 
75
+        let ers_bin = std::env::current_exe()
76
+            .ok()
77
+            .and_then(|p| p.parent().map(|d| d.join("ers")))
78
+            .filter(|p| p.exists())
79
+            .map(|p| p.to_string_lossy().to_string())
80
+            .unwrap_or_else(|| "ers".to_string());
81
+
7482
         let cmd = format!(
75
-            "ers --active-only --width {} --radius {} --color '{}' --inactive '{}'",
76
-            self.border_width, self.radius,
83
+            "{} --active-only --width {} --radius {} --color '{}' --inactive '{}'",
84
+            ers_bin, self.border_width, self.radius,
7785
             self.focused_color.to_hex(), self.unfocused_color.to_hex(),
7886
         );
7987
         tracing::debug!(cmd, "spawning ers");