From d40b56da375dda09ec1bf0d386c0479116609ffa Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Tue, 30 May 2023 18:06:32 -0400 Subject: [PATCH] bail on CTRL-C --- src/Mtlstats.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Mtlstats.hs b/src/Mtlstats.hs index 339d2e9..3e7406a 100644 --- a/src/Mtlstats.hs +++ b/src/Mtlstats.hs @@ -22,11 +22,16 @@ along with this program. If not, see . module Mtlstats (app) where import Brick.AttrMap (AttrMap, forceAttrMap) -import Brick.Main (App (..), showFirstCursor) -import Brick.Types (Widget) +import Brick.Main (App (..), halt, showFirstCursor) +import Brick.Types (BrickEvent (VtyEvent), Widget) import Brick.Util (on) import Brick.Widgets.Core (fill) import Graphics.Vty.Attributes.Color (blue, white) +import Graphics.Vty.Input.Events + ( Event (EvKey) + , Modifier (MCtrl) + , Key (KChar) + ) import Lens.Micro (to) import Lens.Micro.Mtl (use) @@ -50,6 +55,7 @@ draw s = ] handler :: Handler () +handler (VtyEvent (EvKey (KChar 'c') [MCtrl])) = halt handler e = do c <- use (to dispatch) handleController c e