aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-04-12 16:44:35 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:46 -0600
commit1fd52349f8b93fdc8bb5f6e94bcae93f1d1f6bc4 (patch)
treeee9b802b60468a98e00793b4a8823a99a3bce5b0 /src/Rahm/Desktop
parentf8c8240793a9992db68f07e75281e7f549406648 (diff)
downloadrde-1fd52349f8b93fdc8bb5f6e94bcae93f1d1f6bc4.tar.gz
rde-1fd52349f8b93fdc8bb5f6e94bcae93f1d1f6bc4.tar.bz2
rde-1fd52349f8b93fdc8bb5f6e94bcae93f1d1f6bc4.zip
Fix repeatable key to do an action when first pressed.
Diffstat (limited to 'src/Rahm/Desktop')
-rw-r--r--src/Rahm/Desktop/Keys.hs26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index 321d185..622fd3a 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -115,17 +115,19 @@ button15 :: Button
button15 = 15
keyBindingToKeymap :: (XConfig l -> KeyBindings) -> KeyMap l
-keyBindingToKeymap bindings config = fmap bindingToX (bindings config)
+keyBindingToKeymap bindings config = Map.mapWithKey bindingToX (bindings config)
where
- bindingToX b =
+ bindingToX :: (KeyMask, KeySym) -> Documented KeyBinding -> X ()
+ bindingToX key b =
case b of
Documented _ (Action x) -> x
Documented _ (Submap mapping) ->
- submap (fmap bindingToX mapping)
- Documented _ (Repeat mapping) ->
+ submap (Map.mapWithKey bindingToX mapping)
+ Documented _ (Repeat mapping) -> do
+ mapM_ (bindingToX key) (Map.lookup key mapping)
fix $ \recur ->
- submap (fmap (\b -> bindingToX b >> recur) mapping)
+ submap (Map.mapWithKey (\k b -> bindingToX k b >> recur) mapping)
keymap :: XConfig l -> KeyBindings
keymap = runKeys $ do
@@ -451,6 +453,20 @@ keymap = runKeys $ do
(noMod -|- justMod) $ doc "Toggle the hole" $
sendMessage toggleHole
+ let spaceResize = repeatable $ do
+ bind xK_bracketright $ do
+ noMod $
+ doc "Increase the gaps between windows." $
+ sendMessage $ modifyWindowBorder 5
+
+ bind xK_bracketleft $ do
+ noMod $
+ doc "Decrease the gaps between windows." $
+ sendMessage $ modifyWindowBorder (-5)
+
+ bind xK_bracketleft $ noMod spaceResize
+ bind xK_bracketright $ noMod spaceResize
+
bind xK_t $ do
justMod $
doc "Spawn a terminal." $ spawnX (terminal config)