From 80057a6ed33f07f3a91a7a1d3552b222804b5d9e Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 21 Nov 2022 22:14:50 -0700 Subject: Rudimentary pending buffer shown in Xmobar. --- src/Rahm/Desktop/Keys/Wml.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Rahm/Desktop/Keys') diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 1c8d073..10f2b5f 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -34,6 +34,7 @@ import Rahm.Desktop.Marking import qualified Rahm.Desktop.StackSet as W import Rahm.Desktop.Submap import Rahm.Desktop.Workspaces +import Rahm.Desktop.XMobarLog.PendingBuffer import System.Exit (ExitCode (..), exitWith) import Text.Printf import XMonad @@ -182,7 +183,10 @@ class (Monad m) => KeyFeeder m where instance KeyFeeder X where fromX = id - readNextKey = mapNextStringWithKeysym + readNextKey fn = mapNextStringWithKeysym $ + \mask sym str -> do + lift $ fromX $ addStringToPendingBuffer str + fn mask sym str newtype FeedKeys a = FeedKeys {unFeedKeys :: StateT KeyString X a} deriving (Monad, Functor, Applicative) @@ -229,7 +233,7 @@ readNextWorkspaceName = joinMaybe $ workspaceName <$> readNextWorkspace -- Returns the next workspaces associated with the next set of keystrokes. readNextWorkspace :: (KeyFeeder m) => MaybeT m Workspace readNextWorkspace = - readNextKey $ \mask sym str -> + readNextKey $ \mask sym str -> do case (mask, sym, str) of (_, e, _) | e == xK_Escape -> MaybeT $ return Nothing (_, _, [ch]) | isAlphaNum ch || ch == '*' -> return $ justWorkspace [ch] -- cgit