From 4fdc90b31ea56c046dfe5bf9bee0a118f9c03db1 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 5 May 2022 18:27:49 +0300 Subject: [PATCH] Use `open` instead of `xdg-open` in macos TODO: make this configurable instead. --- src/components/mail/view.rs | 33 +++++++++++++++++++++++++--- src/components/mail/view/envelope.rs | 11 +++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/components/mail/view.rs b/src/components/mail/view.rs index 9f7dd5b7..9ee35e8d 100644 --- a/src/components/mail/view.rs +++ b/src/components/mail/view.rs @@ -2334,7 +2334,16 @@ impl Component for MailView { ) .as_ref() .map(|s| s.as_str()) - .unwrap_or("xdg-open"); + .unwrap_or( + #[cfg(target_os = "macos")] + { + "open" + }, + #[cfg(not(target_os = "macos"))] + { + "xdg-open" + }, + ); match Command::new(url_launcher) .arg(url) .stdin(Stdio::piped()) @@ -2622,7 +2631,16 @@ impl Component for MailView { ) .as_ref() .map(|s| s.as_str()) - .unwrap_or("xdg-open"); + .unwrap_or( + #[cfg(target_os = "macos")] + { + "open" + }, + #[cfg(not(target_os = "macos"))] + { + "xdg-open" + }, + ); match Command::new(url_launcher) .arg(String::from_utf8_lossy(url).into_owned()) .stdin(Stdio::piped()) @@ -2656,7 +2674,16 @@ impl Component for MailView { ) .as_ref() .map(|s| s.as_str()) - .unwrap_or("xdg-open"); + .unwrap_or( + #[cfg(target_os = "macos")] + { + "open" + }, + #[cfg(not(target_os = "macos"))] + { + "xdg-open" + }, + ); match Command::new(url_launcher) .arg(actions.archive.unwrap()) .stdin(Stdio::piped()) diff --git a/src/components/mail/view/envelope.rs b/src/components/mail/view/envelope.rs index 6a36a884..9e1ccda8 100644 --- a/src/components/mail/view/envelope.rs +++ b/src/components/mail/view/envelope.rs @@ -498,7 +498,16 @@ impl Component for EnvelopeView { .url_launcher .as_ref() .map(|s| s.as_str()) - .unwrap_or("xdg-open"); + .unwrap_or( + #[cfg(target_os = "macos")] + { + "open" + }, + #[cfg(not(target_os = "macos"))] + { + "xdg-open" + }, + ); match Command::new(url_launcher) .arg(url) .stdin(Stdio::piped())