diff --git a/README.md b/README.md index 97959de..ee0a0c9 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ $ open # Windows $ start # Linux -$ open || xdg-open || gnome-open || kde-open +$ xdg-open || gio open || gnome-open || kde-open || wslview ``` # Usage diff --git a/src/lib.rs b/src/lib.rs index d4d0ba6..1367e85 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -252,18 +252,28 @@ mod unix { use which::which; pub fn that + Sized>(path: T) -> Result { - ["xdg-open", "gnome-open", "kde-open", "wslview"] // Open handlers + ["xdg-open", "gio", "gnome-open", "kde-open", "wslview"] // Open handlers .iter() .find(|it| which(it).is_ok()) // find the first handler that exists .ok_or(Error::from_raw_os_error(0)) // If not found, return err .and_then(|program| { // If found run the handler - Command::new(program) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .arg(path.as_ref()) - .spawn()? - .wait() + if *program == "gio" { + Command::new(program) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .arg("open") + .arg(path.as_ref()) + .spawn()? + .wait() + } else { + Command::new(program) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .arg(path.as_ref()) + .spawn()? + .wait() + } }) }