From cdeb040db0bf986d686b83f25c1e3a439e56604a Mon Sep 17 00:00:00 2001 From: Navid Sassan Date: Sun, 18 Feb 2024 22:57:26 +0100 Subject: [PATCH] make path variable --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d4b6d3b..111e153 100644 --- a/src/main.rs +++ b/src/main.rs @@ -152,6 +152,11 @@ fn handle_select() { dbg!(&rofi_retv); dbg!(&rofi_info); + let executable_path = env::current_exe().unwrap_or_else(|err| { + error!("Failed to get the path to the executable: {:?}", err); + process::exit(2); + }); + match rofi_retv { Err(_) => { // this means rofi is not running yet, so let's start it @@ -160,7 +165,7 @@ fn handle_select() { .arg("-show") .arg("bw") .arg("-modes") - .arg("bw:./target/debug/bw-menu select") // todo: set the path according to argv[0] + .arg(format!("bw:{} select", &executable_path.to_string_lossy())) // we need to remap some default so that we can use the keys for custom binds .arg("-kb-accept-alt") .arg("F12")