1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 11:17:15 +03:00

use the open crate for url clicking

This commit is contained in:
Wez Furlong 2019-02-18 22:57:40 -08:00
parent 3812ec55b1
commit 4c39faffbe
5 changed files with 8 additions and 11 deletions

View File

@ -23,6 +23,7 @@ rusttype = "0.7"
clipboard = "0.5"
unicode-normalization = "~0.1"
freetype = "~0.4"
open = "1.2"
[target.'cfg(unix)'.dependencies]
harfbuzz-sys = "~0.2"

View File

@ -28,6 +28,7 @@ case `lsb_release -ds` in
libfreetype6-dev \
libegl1-mesa-dev \
libharfbuzz-dev \
xdg-utils \
ragel
;;
*)

View File

@ -1,7 +1,7 @@
//! Generic system dependent windows via glium+glutin
use super::Child;
use super::MasterPty;
use super::{Child, Command};
use clipboard::{ClipboardContext, ClipboardProvider};
use config::Config;
use failure::Error;
@ -67,12 +67,9 @@ impl term::TerminalHost for Host {
&mut self.pty
}
fn click_link(&mut self, link: &Rc<Hyperlink>) {
// TODO: make this configurable
let mut cmd = Command::new("xdg-open");
cmd.arg(link.uri());
match cmd.spawn() {
match open::that(link.uri()) {
Ok(_) => {}
Err(err) => eprintln!("failed to spawn xdg-open {}: {:?}", link.uri(), err),
Err(err) => eprintln!("failed to open {}: {:?}", link.uri(), err),
}
}

View File

@ -27,6 +27,7 @@ extern crate serde;
extern crate serde_derive;
extern crate clipboard;
extern crate font_loader;
extern crate open;
extern crate rusttype;
extern crate term;
extern crate termwiz;

View File

@ -121,12 +121,9 @@ impl<'a> term::TerminalHost for TabHost<'a> {
}
fn click_link(&mut self, link: &Rc<Hyperlink>) {
// TODO: make this configurable
let mut cmd = Command::new("xdg-open");
cmd.arg(&link.uri());
match cmd.spawn() {
match open::that(link.uri()) {
Ok(_) => {}
Err(err) => eprintln!("failed to spawn xdg-open {}: {:?}", link.uri(), err),
Err(err) => eprintln!("failed to open {}: {:?}", link.uri(), err),
}
}