diff options
author | Kam Kudla <kam@kam.codes> | 2021-04-08 14:01:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 21:01:47 +0000 |
commit | 40bcdb11335cc49d4d42694b953be746cb383cb9 (patch) | |
tree | 7f82911227a6e6e6269e1ab3e632e2ac86a14032 | |
parent | 78953e4f7e89d0e90b8e1981bf76b03df16eded3 (diff) | |
download | alacritty-40bcdb11335cc49d4d42694b953be746cb383cb9.tar.gz alacritty-40bcdb11335cc49d4d42694b953be746cb383cb9.zip |
Add hide other windows binding on macOS
Fixes #3697.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty.yml | 39 | ||||
-rw-r--r-- | alacritty/src/config/bindings.rs | 5 | ||||
-rw-r--r-- | alacritty/src/input.rs | 2 |
4 files changed, 28 insertions, 19 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b3ebad..2fa883bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - IME composition preview not appearing on Windows - Synchronized terminal updates using `DCS = 1 s ST`/`DCS = 2 s ST` - Regex terminal hints ([see features.md](./docs/features.md#hints)) +- macOS keybinding (cmd+alt+H) hiding all windows other than Alacritty ### Fixed diff --git a/alacritty.yml b/alacritty.yml index 3df946a9..6cca5b76 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -821,25 +821,26 @@ #- { key: Return, mods: Alt, action: ToggleFullscreen } # (macOS only) - #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } - #- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory } - #- { key: Key0, mods: Command, action: ResetFontSize } - #- { key: Equals, mods: Command, action: IncreaseFontSize } - #- { key: Plus, mods: Command, action: IncreaseFontSize } - #- { key: NumpadAdd, mods: Command, action: IncreaseFontSize } - #- { key: Minus, mods: Command, action: DecreaseFontSize } - #- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize } - #- { key: V, mods: Command, action: Paste } - #- { key: C, mods: Command, action: Copy } - #- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection } - #- { key: H, mods: Command, action: Hide } - #- { key: M, mods: Command, action: Minimize } - #- { key: Q, mods: Command, action: Quit } - #- { key: W, mods: Command, action: Quit } - #- { key: N, mods: Command, action: SpawnNewInstance } - #- { key: F, mods: Command|Control, action: ToggleFullscreen } - #- { key: F, mods: Command, mode: ~Search, action: SearchForward } - #- { key: B, mods: Command, mode: ~Search, action: SearchBackward } + #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } + #- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory } + #- { key: Key0, mods: Command, action: ResetFontSize } + #- { key: Equals, mods: Command, action: IncreaseFontSize } + #- { key: Plus, mods: Command, action: IncreaseFontSize } + #- { key: NumpadAdd, mods: Command, action: IncreaseFontSize } + #- { key: Minus, mods: Command, action: DecreaseFontSize } + #- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize } + #- { key: V, mods: Command, action: Paste } + #- { key: C, mods: Command, action: Copy } + #- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection } + #- { key: H, mods: Command, action: Hide } + #- { key: H, mods: Command|Alt, action: HideOtherApplications } + #- { key: M, mods: Command, action: Minimize } + #- { key: Q, mods: Command, action: Quit } + #- { key: W, mods: Command, action: Quit } + #- { key: N, mods: Command, action: SpawnNewInstance } + #- { key: F, mods: Command|Control, action: ToggleFullscreen } + #- { key: F, mods: Command, mode: ~Search, action: SearchForward } + #- { key: B, mods: Command, mode: ~Search, action: SearchBackward } #debug: # Display the time it takes to redraw each frame. diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs index 732875db..91cc09d6 100644 --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -161,6 +161,10 @@ pub enum Action { /// Hide the Alacritty window. Hide, + /// Hide all windows other than Alacritty on macOS. + #[cfg(target_os = "macos")] + HideOtherApplications, + /// Minimize the Alacritty window. Minimize, @@ -685,6 +689,7 @@ pub fn platform_key_bindings() -> Vec<KeyBinding> { C, ModifiersState::LOGO; Action::Copy; C, ModifiersState::LOGO, +BindingMode::VI, ~BindingMode::SEARCH; Action::ClearSelection; H, ModifiersState::LOGO; Action::Hide; + H, ModifiersState::LOGO | ModifiersState::ALT; Action::HideOtherApplications; M, ModifiersState::LOGO; Action::Minimize; Q, ModifiersState::LOGO; Action::Quit; W, ModifiersState::LOGO; Action::Quit; diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index a66511cf..38a346d9 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -255,6 +255,8 @@ impl<T: EventListener> Execute<T> for Action { Action::ToggleSimpleFullscreen => ctx.window_mut().toggle_simple_fullscreen(), #[cfg(target_os = "macos")] Action::Hide => ctx.event_loop().hide_application(), + #[cfg(target_os = "macos")] + Action::HideOtherApplications => ctx.event_loop().hide_other_applications(), #[cfg(not(target_os = "macos"))] Action::Hide => ctx.window().set_visible(false), Action::Minimize => ctx.window().set_minimized(true), |