diff options
-rw-r--r-- | alacritty.yml | 2 | ||||
-rw-r--r-- | alacritty_macos.yml | 2 | ||||
-rw-r--r-- | src/config.rs | 3 | ||||
-rw-r--r-- | src/input.rs | 7 |
4 files changed, 13 insertions, 1 deletions
diff --git a/alacritty.yml b/alacritty.yml index 96fe6e24..83b120f2 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -144,6 +144,8 @@ colors: key_bindings: - { key: V, mods: Command, action: Paste } - { key: C, mods: Command, action: Copy } + - { key: Q, mods: Command, action: Quit } + - { key: W, mods: Command, action: Quit } - { key: Home, chars: "\x1b[H", mode: ~AppCursor } - { key: Home, chars: "\x1b[1~", mode: AppCursor } - { key: End, chars: "\x1b[F", mode: ~AppCursor } diff --git a/alacritty_macos.yml b/alacritty_macos.yml index 386e4590..a3d8df86 100644 --- a/alacritty_macos.yml +++ b/alacritty_macos.yml @@ -144,6 +144,8 @@ colors: key_bindings: - { key: V, mods: Command, action: Paste } - { key: C, mods: Command, action: Copy } + - { key: Q, mods: Command, action: Quit } + - { key: W, mods: Command, action: Quit } - { key: Home, chars: "\x1b[H", mode: ~AppCursor } - { key: Home, chars: "\x1b[1~", mode: AppCursor } - { key: End, chars: "\x1b[F", mode: ~AppCursor } diff --git a/src/config.rs b/src/config.rs index 05147631..d08b801b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -352,7 +352,7 @@ impl de::Deserialize for ActionWrapper { type Value = ActionWrapper; fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("Paste, Copy, or PasteSelection") + f.write_str("Paste, Copy, PasteSelection, or Quit") } fn visit_str<E>(self, value: &str) -> ::std::result::Result<ActionWrapper, E> @@ -362,6 +362,7 @@ impl de::Deserialize for ActionWrapper { "Paste" => Action::Paste, "Copy" => Action::Copy, "PasteSelection" => Action::PasteSelection, + "Quit" => Action::Quit, _ => return Err(E::invalid_value(Unexpected::Str(value), &self)), })) } diff --git a/src/input.rs b/src/input.rs index 491a91cc..92126387 100644 --- a/src/input.rs +++ b/src/input.rs @@ -137,6 +137,9 @@ pub enum Action { /// Paste contents of selection buffer PasteSelection, + + /// Quits Alacritty. + Quit, } impl Action { @@ -165,6 +168,10 @@ impl Action { warn!("Error loading data from clipboard. {}", Red(err)); }); }, + Action::Quit => { + // FIXME should do a more graceful shutdown + ::std::process::exit(0); + }, } } |