aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-02-02 15:04:38 -0700
committerJosh Rahm <rahm@google.com>2024-02-02 15:04:38 -0700
commit07fa1cb3589e7ad25adb3ef484f45e3cf5e1beb9 (patch)
tree10f3d5554aee5b733c542a9f6372262e3f14b6ea /src/Rahm
parent8d077511f2d06a79e2dc638f46877a394c78d66e (diff)
downloadrde-07fa1cb3589e7ad25adb3ef484f45e3cf5e1beb9.tar.gz
rde-07fa1cb3589e7ad25adb3ef484f45e3cf5e1beb9.tar.bz2
rde-07fa1cb3589e7ad25adb3ef484f45e3cf5e1beb9.zip
Configure some more mod3 keys; add a test mod2 key.
Diffstat (limited to 'src/Rahm')
-rw-r--r--src/Rahm/Desktop/Keys.hs67
1 files changed, 46 insertions, 21 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index 8c78571..5402e33 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -267,6 +267,8 @@ data ShiftType = JustShift | ShiftAndFollow | ShiftAndSwap
bindings :: Binder ()
bindings = do
+ let mod3 = rawMask mod3Mask
+
bind xK_apostrophe $ do
justMod $
doc "Jump to a window/tile currently dragging window" $ do
@@ -619,6 +621,9 @@ bindings = do
flip whenJust toggleWindowInSelection =<< withWindowSet (return . W.peek)
bind xK_m $ do
+ rawMask mod2Mask
+ (logs Info "Testing Mod2Mask" :: X ())
+
justMod $
doc
"Mark the windows described by the window set with a given character.\n\n\t\
@@ -838,10 +843,6 @@ bindings = do
bind xK_bracketleft $ noMod spaceResize
bind xK_bracketright $ noMod spaceResize
- bind kcSpace $ do
- rawMask mod3Mask
- playPauseDoc
-
bind xK_t $ do
justMod $
doc "Spawn a terminal." $
@@ -859,9 +860,7 @@ bindings = do
bind xK_i $ do
justMod $ do
- XConf {display = dpy, theRoot = rootw} <- ask
- io $ grabKey dpy 65 32 rootw True grabModeAsync grabModeAsync
- (return () :: X ())
+ logs Info "Numlock mask: %s" =<< (gets (show . numberlockMask)) :: X ()
bind xK_z $ do
justMod $
@@ -920,10 +919,6 @@ bindings = do
noMod mediaNextDoc
rawMask shiftMask mediaSeekFDoc
- bind kcW $ do
- (justMod -|- noMod) $
- (logs Info "Testing keycode press!" :: X ())
-
bindOtherKeys $ \(_, _, s) ->
logs Info "Unhandled key pressed: %s" s
@@ -996,6 +991,15 @@ bindings = do
noMod $ spawnX "set-backlight.sh -0.05"
justMod $ spawnX "set-backlight.sh 0.01"
rawMask shiftMask $ spawnX "set-backlight.sh 0"
+
+ -- Button bindings. These are bindings to buttons on my mouse.
+ --
+ -- I usre a G502 SE HERO Gaming Mouse. This mouse has 13 buttons on it. The
+ -- standard right, left, middle, scroll up/down, wheel tilt left/right,
+ -- forward/back, plus four additional buttons.
+ --
+ -- This allows me to make some pretty complex and powerful mappings with just
+ -- the mouse by using button press sequences to mean different things.
bind button1 $ do
justMod $
doc
@@ -1235,6 +1239,37 @@ bindings = do
)
in windows f >> escape
+ -- Keycode Bindings.
+ --
+ -- These bindings bind directly to KeyCodes rather than keysyms. By
+ -- convention, these keys should map to mod3 to avoid collisions with bindings
+ -- above.
+ --
+ -- Keycode bindings are good for non-mnemonic keys, where the position on the
+ -- keyboard, rather than their character, are the reason for the binding.
+ -- These bindings are consistent across keyboard layouts.
+ --
+ -- In my configuration, the tab key sets mod3 while held down.
+ bind kcQ $
+ mod3 mediaPrevDoc
+
+ bind kcW $
+ mod3 playPauseDoc
+
+ bind kcE $
+ mod3 mediaNextDoc
+
+ bind kcQ $
+ shiftMod $
+ doc "Restarts xmonad. Always binds to the 'Q' key." $
+ spawnX "xmonad --recompile && xmonad --restart"
+
+ bind kcQ $
+ controlMod $
+ doc
+ "Kills xmonad. Always binds to the 'Q' key."
+ (io exitSuccess :: X ())
+
-- where
--
-- permuteMods = map (foldl' (.|.) 0) . filterM (const [True, False])
@@ -1276,7 +1311,6 @@ windowSpecificBindings config = do
let (Bindings keymap keycodemap _) = resolveBindings (runBinder config k)
in tell =<< lift (b --> return (keymap config, keycodemap config))
emitKey = flip sendKey w
- mod3 = rawMask mod3Mask
configureIf (return True) $ do
-- The following are bindings that send keystrokes to the focused window. This
@@ -1335,15 +1369,6 @@ windowSpecificBindings config = do
rawMask (m .|. mod3Mask) $
emitKey (m .|. controlMask, xK_Page_Down)
- bind kcQ $
- mod3 mediaPrev
-
- bind kcW $
- mod3 playPause
-
- bind kcE $
- mod3 mediaNext
-
configureIf (flip elem (browsers ++ spotify) <$> className) $ do
bind xK_h $ do
rawMask controlMask $ emitKey (0, xK_BackSpace)