diff --git a/src/config.rs b/src/config.rs index c4e7049..1c002da 100644 --- a/src/config.rs +++ b/src/config.rs @@ -87,6 +87,7 @@ pub struct Config { pub show_hidden: bool, pub select_cmd: String, pub cd_cmd: String, + pub open_cmd: String, pub icons: bool, pub icons_space: bool, pub media_autoplay: bool, @@ -113,6 +114,7 @@ impl Config { show_hidden: false, select_cmd: "find -type f | fzf -m".to_string(), cd_cmd: "find -type d | fzf".to_string(), + open_cmd: "xdg-open".to_string(), icons: false, icons_space: false, media_autoplay: false, @@ -158,6 +160,10 @@ impl Config { let cmd = cmd.to_string(); config.cd_cmd = cmd; } + Ok(("open_cmd", cmd)) => { + let cmd = cmd.to_string(); + config.open_cmd = cmd; + } Ok(("media_autoplay", "on")) => config.media_autoplay = true, Ok(("media_autoplay", "off")) => config.media_autoplay = false, Ok(("media_mute", "on")) => config.media_mute = true, diff --git a/src/file_browser.rs b/src/file_browser.rs index fcc0c6c..ef3f418 100644 --- a/src/file_browser.rs +++ b/src/file_browser.rs @@ -385,7 +385,13 @@ impl FileBrowser { self.core.get_sender().send(Events::InputEnabled(false))?; self.core.screen.suspend().log(); - let status = std::process::Command::new("xdg-open") + let cmd = self.core + .config.read()? + .get()? + .open_cmd + .clone(); + + let status = std::process::Command::new(cmd.clone()) .args(file.path.file_name()) .status(); @@ -397,10 +403,10 @@ impl FileBrowser { match status { Ok(status) => self.core.show_status(&format!("\"{}\" exited with {}", - "xdg-open", status)).log(), + cmd, status)).log(), Err(err) => self.core.show_status(&format!("Can't run this \"{}\": {}", - "xdg-open", err)).log() + cmd, err)).log() } }