From 0cc68da04f109f66159aadc2404e232ab96bb97e Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sun, 5 Jan 2020 04:54:14 +0300 Subject: Add `Minimize` binding action Fixes #2534. --- alacritty/src/config/bindings.rs | 4 ++++ alacritty/src/input.rs | 1 + alacritty/src/window.rs | 4 ++++ 3 files changed, 9 insertions(+) (limited to 'alacritty/src') 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()); -- cgit