diff options
| author | Josh Rahm <rahm@google.com> | 2022-04-12 16:44:35 -0600 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2022-04-12 16:44:35 -0600 |
| commit | f85c7160e122f367a357d93689947daa1ef241ef (patch) | |
| tree | ee9b802b60468a98e00793b4a8823a99a3bce5b0 /src | |
| parent | e5bee7f2f095bffdef1c31e27f4b036780b01654 (diff) | |
| download | rde-f85c7160e122f367a357d93689947daa1ef241ef.tar.gz rde-f85c7160e122f367a357d93689947daa1ef241ef.tar.bz2 rde-f85c7160e122f367a357d93689947daa1ef241ef.zip | |
Fix repeatable key to do an action when first pressed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Rahm/Desktop/Keys.hs | 26 |
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) |