aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Keys.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-03-24 10:38:05 -0600
committerJosh Rahm <rahm@google.com>2022-03-24 10:38:05 -0600
commit4e718217ada0367b220f0e2134dbf6cbdcb28977 (patch)
tree47d70f94f530f94b7a7da2cecdb5e2c847dfe298 /src/Internal/Keys.hs
parenta87cbc7357566b26c7dca7538d4b03da5f8b999a (diff)
downloadrde-4e718217ada0367b220f0e2134dbf6cbdcb28977.tar.gz
rde-4e718217ada0367b220f0e2134dbf6cbdcb28977.tar.bz2
rde-4e718217ada0367b220f0e2134dbf6cbdcb28977.zip
Add more mouse motions. Add bindings for navigation to button15+<>
Diffstat (limited to 'src/Internal/Keys.hs')
-rw-r--r--src/Internal/Keys.hs48
1 files changed, 38 insertions, 10 deletions
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs
index 195e12f..1118788 100644
--- a/src/Internal/Keys.hs
+++ b/src/Internal/Keys.hs
@@ -45,6 +45,7 @@ import Internal.Lib
import Internal.DMenu
import Internal.PassMenu
import Internal.Logger
+import Internal.ScreenRotate (screenRotateForward, screenRotateBackward)
type KeyMap l = XConfig l -> Map (KeyMask, KeySym) (X ())
type ButtonsMap l = XConfig l -> Map (KeyMask, Button) (Window -> X ())
@@ -376,6 +377,17 @@ mouseMap = runButtons $ do
Map.lookup button (mouseMap config)
subMouse = submapButtonsWithKey defaultButtons . flip runButtons config
+
+ let continuous :: [(Button, X ())] -> Button -> Window -> X ()
+ continuous actions button w = do
+ case find ((==button) . fst) actions of
+ Just (_, action) -> action
+ Nothing -> return ()
+
+ (subMouse $
+ forM_ (map fst actions) $ \b ->
+ bind b $ noMod $ \w -> continuous actions b w) w
+
bind button1 $ do
justMod $ \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster
@@ -406,6 +418,9 @@ mouseMap = runButtons $ do
bind button14 $ do
noMod $ \_ -> click >> sendMessage ToggleZoom
+ bind button15 $ do
+ noMod $ \_ -> spawn "pavucontrol"
+
let mediaButtons = [
(button4, increaseVolume),
(button5, decreaseVolume),
@@ -416,19 +431,32 @@ mouseMap = runButtons $ do
(button7, mediaNext)
]
+ forM_ (map fst mediaButtons) $ \b ->
+ bind b $ noMod $ continuous mediaButtons b
- let continuous :: [(Button, X ())] -> Button -> Window -> X ()
- continuous actions button w = do
- case find ((==button) . fst) actions of
- Just (_, action) -> action
- Nothing -> return ()
+ bind button15 $ do
- (subMouse $
- forM_ (map fst mediaButtons) $ \b ->
- bind b $ noMod $ \w -> continuous actions b w) w
+ noMod $ subMouse $ do
+
+ bind button15 $ do
+ noMod $ \_ -> jumpToLast
- forM_ (map fst mediaButtons) $ \b ->
- bind b $ noMod $ continuous mediaButtons b
+
+ let workspaceButtons = [
+ (button2, swapMaster),
+
+ (button9, relativeWorkspaceShift next),
+ (button8, relativeWorkspaceShift prev),
+
+ (button4, windows W.focusUp),
+ (button5, windows W.focusDown),
+
+ (button7, windows screenRotateForward),
+ (button6, windows screenRotateBackward)
+ ]
+
+ forM_ (map fst workspaceButtons) $ \b ->
+ bind b $ noMod $ continuous workspaceButtons b
applyKeys :: XConfig l -> IO (XConfig l)
applyKeys config =