diff options
| author | Josh Rahm <rahm@google.com> | 2020-03-26 16:48:01 -0600 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2020-03-26 16:48:01 -0600 |
| commit | 63e1d3b9b8685ea77cb488844dddb59a6858c39d (patch) | |
| tree | ccf59439872848698273a18ec50595b3fef929ea /src/Internal/Keys.hs | |
| parent | e57b0a3a870d1f9688491b17afbd5a9d994ad343 (diff) | |
| download | rde-63e1d3b9b8685ea77cb488844dddb59a6858c39d.tar.gz rde-63e1d3b9b8685ea77cb488844dddb59a6858c39d.tar.bz2 rde-63e1d3b9b8685ea77cb488844dddb59a6858c39d.zip | |
Add some bindings for the other buttons on the mouse
Diffstat (limited to 'src/Internal/Keys.hs')
| -rw-r--r-- | src/Internal/Keys.hs | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index 902e743..83d2e08 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -32,14 +32,30 @@ import Internal.Lib type KeyMap l = XConfig l -> Map (KeyMask, KeySym) (X ()) applyKeys :: XConfig l -> IO (XConfig l) -applyKeys config@(XConfig {modMask = modm}) = do - ks <- newKeys - withWindowNavigation (xK_k, xK_h, xK_j, xK_l) $ - config { keys = ks } - -newKeys :: IO (KeyMap l) -newKeys = - withNewMarkContext $ \markContext -> +applyKeys config@(XConfig {modMask = modm}) = + withNewMarkContext $ \markContext -> do + ks <- newKeys markContext + ms <- newMouse markContext + withWindowNavigation (xK_k, xK_h, xK_j, xK_l) $ + config { keys = ks, mouseBindings = ms } + +newMouse :: MarkContext -> IO (XConfig l -> Map (KeyMask, Button) (Window -> X ())) +newMouse markContext = + return $ \config@(XConfig {modMask = modm}) -> + Map.fromList [ + ((modm, button1), \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster) + , ((modm, button2), windows . (W.shiftMaster .) . W.focusWindow) + , ((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster) + + , ((modm, 6), const (relativeWorkspaceShift prev)) + , ((modm, 7), const (relativeWorkspaceShift next)) + + , ((modm, 8), const (relativeWorkspaceShift prev)) + , ((modm, 9), const (relativeWorkspaceShift next)) + ] + +newKeys :: MarkContext -> IO (KeyMap l) +newKeys markContext = return $ \config@(XConfig {modMask = modm}) -> Map.fromList [ ((modm, xK_F12), (void $ spawn "spotify-control next")) @@ -99,7 +115,7 @@ newKeys = -- Buttons programmed on my mouse. , ((shiftMask, xK_F1), withFocused $ windows . W.sink) - , ((shiftMask, xK_F2), kill) + , ((shiftMask, xK_F2), sendMessage ToggleZoom) , ((shiftMask, xK_F3), kill) ] |