diff --git a/CHANGELOG.md b/CHANGELOG.md index e87e2ec0..632c2fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - /Applications symlink into OS X DMG for easier installation - Colored emojis on Linux/BSD - Value `randr` for `WINIT_HIDPI_FACTOR`, to ignore `Xft.dpi` and scale based on screen dimensions +- `Minimize` key binding action, bound to `cmd + m` on macOS ### Changed diff --git a/alacritty.yml b/alacritty.yml index 38303ee4..f30b5707 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -65,14 +65,14 @@ # Window title #title: Alacritty - # Window class (Linux only): + # Window class (Linux/BSD only): #class: # Application instance name #instance: Alacritty # General application class #general: Alacritty - # GTK theme variant (Linux only) + # GTK theme variant (Linux/BSD only) # # Override the variant of the GTK theme. Commonly supported values are `dark` and `light`. # Set this to `None` to use the default theme variant. @@ -107,7 +107,7 @@ # # Default: # - (macOS) Menlo - # - (Linux) monospace + # - (Linux/BSD) monospace # - (Windows) Consolas #family: monospace @@ -324,7 +324,7 @@ # # Default: # - (macOS) /bin/bash --login -# - (Linux) user login shell +# - (Linux/BSD) user login shell # - (Windows) powershell #shell: # program: /bin/bash @@ -396,7 +396,7 @@ # # Default: # - (macOS) open - # - (Linux) xdg-open + # - (Linux/BSD) xdg-open # - (Windows) explorer #launcher: # program: xdg-open @@ -482,6 +482,7 @@ # - ScrollToBottom # - ClearHistory # - Hide +# - Minimize # - Quit # - ToggleFullscreen # - SpawnNewInstance @@ -530,7 +531,7 @@ # be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for # a no-op if you do not wish to receive input characters for that binding. #key_bindings: - # (Windows/Linux only) + # (Windows, Linux, and BSD only) #- { key: V, mods: Control|Shift, action: Paste } #- { key: C, mods: Control|Shift, action: Copy } #- { key: Insert, mods: Shift, action: PasteSelection } @@ -539,6 +540,8 @@ #- { key: Add, mods: Control, action: IncreaseFontSize } #- { key: Subtract, mods: Control, action: DecreaseFontSize } #- { key: Minus, mods: Control, action: DecreaseFontSize } + + # (Windows only) #- { key: Return, mods: Alt, action: ToggleFullscreen } # (macOS only) @@ -551,6 +554,7 @@ #- { key: V, mods: Command, action: Paste } #- { key: C, mods: Command, action: Copy } #- { 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: F, mods: Command|Control, action: ToggleFullscreen } diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs index dbe5d42e..d12c5708 100644 --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -167,6 +167,9 @@ pub enum Action { /// Hide the Alacritty window. Hide, + /// Minimize the Alacritty window. + Minimize, + /// Quit Alacritty. Quit, @@ -430,6 +433,7 @@ pub fn platform_key_bindings() -> Vec { Key::V, ModifiersState::LOGO; Action::Paste; Key::C, ModifiersState::LOGO; Action::Copy; Key::H, ModifiersState::LOGO; Action::Hide; + Key::M, ModifiersState::LOGO; Action::Minimize; Key::Q, ModifiersState::LOGO; Action::Quit; Key::W, ModifiersState::LOGO; Action::Quit; ) diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index dff46515..08383eab 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -137,6 +137,7 @@ impl Execute for Action { #[cfg(target_os = "macos")] Action::ToggleSimpleFullscreen => ctx.window_mut().toggle_simple_fullscreen(), Action::Hide => ctx.window().set_visible(false), + Action::Minimize => ctx.window().set_minimized(true), Action::Quit => ctx.terminal_mut().exit(), Action::IncreaseFontSize => ctx.change_font_size(FONT_SIZE_STEP), Action::DecreaseFontSize => ctx.change_font_size(FONT_SIZE_STEP * -1.), diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs index 159e746e..33594741 100644 --- a/alacritty/src/window.rs +++ b/alacritty/src/window.rs @@ -319,6 +319,10 @@ impl Window { self.window().set_maximized(maximized); } + pub fn set_minimized(&self, minimized: bool) { + self.window().set_minimized(minimized); + } + /// Toggle the window's fullscreen state pub fn toggle_fullscreen(&mut self) { self.set_fullscreen(self.window().fullscreen().is_none());