From 20c9f664d702724d0a7758aa41015fa23d8f64ed Mon Sep 17 00:00:00 2001 From: Rotem Yaari Date: Tue, 26 Nov 2024 11:17:44 +0200 Subject: [PATCH] Make ctrl+c quit the app --- src/input/processor/normal.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/input/processor/normal.rs b/src/input/processor/normal.rs index 94e2601..63db836 100644 --- a/src/input/processor/normal.rs +++ b/src/input/processor/normal.rs @@ -1,5 +1,5 @@ use std::sync::mpsc::Sender; -use crossterm::event::{KeyCode, KeyEvent}; +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use crate::dispatcher::Dispatcher; use crate::event::GlimEvent; use crate::id::ProjectId; @@ -24,13 +24,18 @@ impl NormalModeProcessor { event: &KeyEvent, ) { if let Some(e) = match event.code { - KeyCode::Enter if self.selected.is_some() => - Some(GlimEvent::OpenProjectDetails(self.selected.unwrap())), + KeyCode::Enter if self.selected.is_some() => { + Some(GlimEvent::OpenProjectDetails(self.selected.unwrap())) + } + KeyCode::Char(c) + if c == 'q' || (c == 'c' && event.modifiers.contains(KeyModifiers::CONTROL)) => + { + Some(GlimEvent::Shutdown) + } KeyCode::Char('a') => Some(GlimEvent::ShowLastNotification), KeyCode::Char('c') => Some(GlimEvent::DisplayConfig), KeyCode::Char('l') => Some(GlimEvent::ToggleInternalLogs), KeyCode::Char('p') => self.selected.map(GlimEvent::RequestPipelines), - KeyCode::Char('q') => Some(GlimEvent::Shutdown), KeyCode::Char('r') => Some(GlimEvent::RequestProjects), KeyCode::Char('w') => self.selected.map(GlimEvent::BrowseToProject), KeyCode::Up => Some(GlimEvent::SelectPreviousProject),