Skip to content

Instantly share code, notes, and snippets.

@robertgzr
Last active December 18, 2020 15:47
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertgzr/34e1a90b885037e2ccef870740f4763d to your computer and use it in GitHub Desktop.
Save robertgzr/34e1a90b885037e2ccef870740f4763d to your computer and use it in GitHub Desktop.
new window patch for https://github.com/jwilm/alacritty
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);
@timemachine3030
Copy link

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