diff options
Diffstat (limited to 'src/Rahm/Desktop/Keys.hs')
| -rw-r--r-- | src/Rahm/Desktop/Keys.hs | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index d8b7f20..db0d7fb 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -139,24 +139,21 @@ keyBindingToKeymap bindings config = Map.mapWithKey bindingToX (bindings config) case b of Documented _ (Action x) -> x Documented _ (Submap mapping) -> - withPendingBuffer $ do - -- This is a submap, add it to the pending buffer. - -- - -- This could potentially use the current event in the XState and - -- lookupString to potentially recover the real string typed, but - -- for now, this will do. - addStringToPendingBuffer (keysymToString $ snd key) + -- This is a submap, add it to the pending buffer. + -- + -- This could potentially use the current event in the XState and + -- lookupString to potentially recover the real string typed, but + -- for now, this will do. + pushAddPendingBuffer (keysymToString $ snd key) $ do submap (Map.mapWithKey bindingToX mapping) Documented _ (Repeat mapping) -> do - withPendingBuffer $ do - addStringToPendingBuffer (keysymToString $ snd key) + pushAddPendingBuffer (keysymToString $ snd key) $ do mapM_ (bindingToX key) (Map.lookup key mapping) fix $ \recur -> do submap ( Map.mapWithKey ( \k b -> do - withPendingBuffer $ do - addStringToPendingBuffer (keysymToString $ snd k) + pushAddPendingBuffer (keysymToString $ snd k) $ bindingToX k b >> recur ) mapping @@ -172,8 +169,7 @@ keymap = runKeys $ do forM_ [xK_apostrophe, xK_w] $ \k -> bind k $ do justMod $ doc "Jumps between marks." $ - withPendingBuffer $ do - setPendingBuffer "w " + pushPendingBuffer "w " $ do runMaybeT_ $ do l <- readNextLocationSet case l of @@ -313,14 +309,12 @@ keymap = runKeys $ do \_: Black hole. Sending a window here closes it.\n\n\t\ \Other keybindings starting with H-g\n\t\t\ \F1: display this help.\n\n\t" - $ withPendingBuffer $ do - setPendingBuffer "g " + $ pushPendingBuffer "g " $ runMaybeT_ $ (lift . gotoWorkspaceFn) =<< readNextWorkspace controlMod $ doc "Restore the desktop marked with the next typed character." $ - withPendingBuffer $ do - setPendingBuffer "C-g " + pushPendingBuffer "C-g " $ runMaybeT_ $ do mapNextString $ \_ str -> lift $ case str of @@ -335,8 +329,7 @@ keymap = runKeys $ do shiftMod $ doc "Restore a theater state" $ - withPendingBuffer $ do - setPendingBuffer "G " + pushPendingBuffer "G " $ runMaybeT_ $ do mapNextString $ \_ str -> lift $ case str of @@ -385,15 +378,13 @@ keymap = runKeys $ do bind xK_w $ noMod $ doc "Record a windowset macro" $ - withPendingBuffer $ do - setPendingBuffer "Win Macro " + pushPendingBuffer "Win Macro " $ runMaybeT_ readWindowsetMacro bind xK_t $ noMod $ doc "Record a workspace macro" $ - withPendingBuffer $ do - setPendingBuffer "Wksp Macro " + pushPendingBuffer "Wksp Macro " $ runMaybeT_ readWorkspaceMacro bind xK_h $ do @@ -456,8 +447,7 @@ keymap = runKeys $ do bind xK_m $ do justMod $ doc "Mark the current window with the next typed character." $ do - withPendingBuffer $ do - addStringToPendingBuffer "m " + pushPendingBuffer "m " $ do locs <- fromMaybe [] <$> runMaybeT readNextLocationSet let wins = mapMaybe locationWindow locs unless (null wins) $ do @@ -470,8 +460,7 @@ keymap = runKeys $ do shiftMod $ doc "Mark the current desktop with the next typed character." $ - withPendingBuffer $ do - addStringToPendingBuffer "M " + pushPendingBuffer "M " $ runMaybeT_ $ do mapNextString $ \_ str -> lift $ case str of @@ -480,8 +469,7 @@ keymap = runKeys $ do controlMod $ doc "Mark the current theater with the next typed character." $ - withPendingBuffer $ do - addStringToPendingBuffer "C-M " + pushPendingBuffer "C-M " $ runMaybeT_ $ do mapNextString $ \_ str -> lift $ case str of @@ -524,8 +512,7 @@ keymap = runKeys $ do then "Swap a windowset with another windowset." else "Shift a windowset to a workspace" ) - $ withPendingBuffer $ do - setPendingBuffer $ if doSwap then "S " else "s " + $ pushPendingBuffer (if doSwap then "S " else "s ") $ do maybeLocs <- runMaybeT readNextLocationSet forM_ maybeLocs $ \locations -> do |