Last active
December 18, 2020 15:47
-
-
Save robertgzr/34e1a90b885037e2ccef870740f4763d to your computer and use it in GitHub Desktop.
new window patch for https://github.com/jwilm/alacritty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/config.rs b/src/config.rs | |
index 5142b9b..80fe5a2 100644 | |
--- a/src/config.rs | |
+++ b/src/config.rs | |
@@ -369,6 +369,7 @@ impl de::Deserialize for ActionWrapper { | |
"Paste" => Action::Paste, | |
"Copy" => Action::Copy, | |
"PasteSelection" => Action::PasteSelection, | |
+ "OpenNewWindow" => Action::OpenNewWindow, | |
"Quit" => Action::Quit, | |
_ => return Err(E::invalid_value(Unexpected::Str(value), &self)), | |
})) | |
diff --git a/src/input.rs b/src/input.rs | |
index de8bca4..9fdaa2f 100644 | |
--- a/src/input.rs | |
+++ b/src/input.rs | |
@@ -148,6 +148,9 @@ pub enum Action { | |
/// Run given command | |
Command(String, Vec<String>), | |
+ /// Opens a new window | |
+ OpenNewWindow, | |
+ | |
/// Quits Alacritty. | |
Quit, | |
} | |
@@ -189,6 +192,14 @@ impl Action { | |
}, | |
} | |
}, | |
+ Action::OpenNewWindow => { | |
+ ::std::process::Command::new("/usr/local/bin/alacritty") | |
+ .spawn() | |
+ .map(|child| { println!("subproces pid: {}", child.id()) }) | |
+ .unwrap_or_else(|err| { | |
+ warn!("Error spawning subprocess. {}", Red(err)); | |
+ }); | |
+ } | |
Action::Quit => { | |
// FIXME should do a more graceful shutdown | |
::std::process::exit(0); |
Thank you, @kergoth. Very useful.
For Linux, if alacritty is in your path, Alt+n
- { key: N, mods: Alt, command: { program: "alacritty", args: [] } }
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is workable without a patch using the 'command' mechanism (though this particular example is mac-specific):