From d290f532d41b4355f3a2e703f7713707e19a5462 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 15 Mar 2022 07:47:59 -0700 Subject: [PATCH] fix hang with open crate when spawning the browser The `open` crate blocks forever when spawning the browser via xdg-open, which feels kinda "wrong" to me, but does offer a method that can stick that in a background thread, so that's what we do here. refs: #1721 --- docs/changelog.md | 1 + wezterm-gui/src/termwindow/mod.rs | 4 +--- wezterm-toast-notification/src/dbus.rs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index dc6976712..3420c9b99 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -73,6 +73,7 @@ As features stabilize some brief notes about them will accumulate here. * Fall back from `top_left_arrow` to `left_ptr` when loading XCursor themes [#1655](https://github.com/wez/wezterm/issues/1655) * Fixed lingering hover state in titlebar when the mouse pointer left the window. Thanks to [@davidrios](https://github.com/davidrios)! [#1434](https://github.com/wez/wezterm/issues/1434) * We now respect the difference between `Italic` and `Oblique` font styles when matching fonts. You may explicitly specify `style="Oblique"` rather than using `italic=true` for fonts that offer both italic and oblique variants. [#1646](https://github.com/wez/wezterm/issues/1646) +* Hang when clicking a URL would launch the browser for the first time on unix systems [#1721](https://github.com/wez/wezterm/issues/1721) ### 20220101-133340-7edc5b5a diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index 56e2e2ac0..002112720 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -2282,9 +2282,7 @@ impl TermWindow { }; if default_click { log::info!("clicking {}", link); - if let Err(err) = open::that(&link) { - log::error!("failed to open {}: {:?}", link, err); - } + open::that_in_background(&link); } Ok(()) } diff --git a/wezterm-toast-notification/src/dbus.rs b/wezterm-toast-notification/src/dbus.rs index 8eb1779b2..ef0e7426c 100644 --- a/wezterm-toast-notification/src/dbus.rs +++ b/wezterm-toast-notification/src/dbus.rs @@ -126,7 +126,7 @@ async fn show_notif_impl(notif: ToastNotification) -> Result<(), Box