From bf3e8a0b8a66adcbba10f369b707e606ab26c068 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Tue, 26 Nov 2024 14:47:35 +0100 Subject: [PATCH] fix(opener): Try `/usr/bin/xdg-open` first --- plugins/opener/src/open.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/opener/src/open.rs b/plugins/opener/src/open.rs index bbd836e3..fe721f9c 100644 --- a/plugins/opener/src/open.rs +++ b/plugins/opener/src/open.rs @@ -9,7 +9,14 @@ use std::{ffi::OsStr, path::Path}; pub(crate) fn open, S: AsRef>(path: P, with: Option) -> crate::Result<()> { match with { Some(program) => ::open::with_detached(path, program.as_ref()), - None => ::open::that_detached(path), + None => { + // ref https://github.com/tauri-apps/tauri/issues/10617 + #[cfg(target_os = "linux")] + return ::open::with_detached(&path, "/usr/bin/xdg-open") + .or_else(|_| ::open::that_detached(path)); + #[cfg(not(target_os = "linux"))] + ::open::that_detached(path) + } } .map_err(Into::into) }