diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2020-06-05 01:10:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-05 01:10:31 +0300 |
commit | f99220f01553c6c9d36e1f4ce01c007f4d4d4cb5 (patch) | |
tree | a61843b8ffe5fc25cc3a35157bc1a4346f37d40b /alacritty/src/config/mouse.rs | |
parent | 1e32e5a5154a2e765ca0b3ab8e50e4c01bbe5d18 (diff) | |
download | r-alacritty-f99220f01553c6c9d36e1f4ce01c007f4d4d4cb5.tar.gz r-alacritty-f99220f01553c6c9d36e1f4ce01c007f4d4d4cb5.tar.bz2 r-alacritty-f99220f01553c6c9d36e1f4ce01c007f4d4d4cb5.zip |
Refactor Shell, Command, and Launcher to share impl
Diffstat (limited to 'alacritty/src/config/mouse.rs')
-rw-r--r-- | alacritty/src/config/mouse.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/alacritty/src/config/mouse.rs b/alacritty/src/config/mouse.rs index 9192aba9..1a5aec3d 100644 --- a/alacritty/src/config/mouse.rs +++ b/alacritty/src/config/mouse.rs @@ -4,9 +4,9 @@ use glutin::event::ModifiersState; use log::error; use serde::{Deserialize, Deserializer}; -use alacritty_terminal::config::{failure_default, LOG_TARGET_CONFIG}; +use alacritty_terminal::config::{failure_default, Program, LOG_TARGET_CONFIG}; -use crate::config::bindings::{CommandWrapper, ModsWrapper}; +use crate::config::bindings::ModsWrapper; #[serde(default)] #[derive(Default, Clone, Debug, Deserialize, PartialEq, Eq)] @@ -26,7 +26,7 @@ pub struct Mouse { pub struct Url { /// Program for opening links. #[serde(deserialize_with = "deserialize_launcher")] - pub launcher: Option<CommandWrapper>, + pub launcher: Option<Program>, /// Modifier used to open links. #[serde(deserialize_with = "failure_default")] @@ -39,9 +39,7 @@ impl Url { } } -fn deserialize_launcher<'a, D>( - deserializer: D, -) -> ::std::result::Result<Option<CommandWrapper>, D::Error> +fn deserialize_launcher<'a, D>(deserializer: D) -> std::result::Result<Option<Program>, D::Error> where D: Deserializer<'a>, { @@ -55,7 +53,7 @@ where return Ok(None); } - match <Option<CommandWrapper>>::deserialize(val) { + match <Option<Program>>::deserialize(val) { Ok(launcher) => Ok(launcher), Err(err) => { error!( @@ -73,11 +71,11 @@ impl Default for Url { fn default() -> Url { Url { #[cfg(not(any(target_os = "macos", windows)))] - launcher: Some(CommandWrapper::Just(String::from("xdg-open"))), + launcher: Some(Program::Just(String::from("xdg-open"))), #[cfg(target_os = "macos")] - launcher: Some(CommandWrapper::Just(String::from("open"))), + launcher: Some(Program::Just(String::from("open"))), #[cfg(windows)] - launcher: Some(CommandWrapper::Just(String::from("explorer"))), + launcher: Some(Program::Just(String::from("explorer"))), modifiers: Default::default(), } } |