aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2020-03-26 16:48:01 -0600
committerJosh Rahm <rahm@google.com>2020-03-26 16:48:01 -0600
commit63e1d3b9b8685ea77cb488844dddb59a6858c39d (patch)
treeccf59439872848698273a18ec50595b3fef929ea
parente57b0a3a870d1f9688491b17afbd5a9d994ad343 (diff)
downloadrde-63e1d3b9b8685ea77cb488844dddb59a6858c39d.tar.gz
rde-63e1d3b9b8685ea77cb488844dddb59a6858c39d.tar.bz2
rde-63e1d3b9b8685ea77cb488844dddb59a6858c39d.zip
Add some bindings for the other buttons on the mouse
-rw-r--r--src/Internal/Keys.hs34
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)
]