aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-01-30 23:14:40 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-01-30 23:14:40 -0700
commit2ec6937f9935123fd23f915ceb05385113f143bb (patch)
tree26b65e7e662b4479f50031abbf55c0141705bd61
parent53cc84ffd9212c2253e33cab1267cfcd272f5e11 (diff)
downloadrde-2ec6937f9935123fd23f915ceb05385113f143bb.tar.gz
rde-2ec6937f9935123fd23f915ceb05385113f143bb.tar.bz2
rde-2ec6937f9935123fd23f915ceb05385113f143bb.zip
Add movement keybindings to Mod3.
These keybindings give me the ability to use arrow keys and other movement keys without physical keys. This is helped by my keyboard script which maps Tab to Hyper when held down, so tab acts like a function key of sorts.
-rw-r--r--src/Rahm/Desktop/Keys.hs63
1 files changed, 62 insertions, 1 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index 7bceeef..0bf3ba0 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -141,7 +141,7 @@ import Rahm.Desktop.XMobarLog.PendingBuffer
pushAddPendingBuffer,
pushPendingBuffer,
)
-import System.Exit (exitSuccess, exitFailure)
+import System.Exit (exitFailure, exitSuccess)
import Text.Printf (printf)
import XMonad as X
import XMonad.Actions.CopyWindow as CopyWindow
@@ -1192,6 +1192,10 @@ bindings = do
)
in windows f >> escape
+-- where
+--
+-- permuteMods = map (foldl' (.|.) 0) . filterM (const [True, False])
+
myMouseMoveWindow =
D.mouseMoveWindowAndThen X.focus $
mconcat
@@ -1230,6 +1234,63 @@ windowSpecificBindings config = do
in tell =<< lift (b --> return (keymap config))
emitKey = flip sendKey w
+ configureIf (return True) $ do
+ -- The following are bindings that send keystrokes to the focused window. This
+ -- makes navigating with arrow keys and whatnot much easier.
+ forM_ (permuteMods [0, controlMask, shiftMask]) $ \mods -> do
+ bind xK_c $
+ rawMask (mod3Mask .|. mods) $
+ emitKey (mods, xK_Up)
+
+ bind xK_t $
+ rawMask (mod3Mask .|. mods) $
+ emitKey (mods, xK_Down)
+
+ bind xK_h $
+ rawMask (mod3Mask .|. mods) $
+ emitKey (mods, xK_Left)
+
+ bind xK_n $
+ rawMask (mod3Mask .|. mods) $
+ emitKey (mods, xK_Right)
+
+ forM_ [0, shiftMask] $ \m -> do
+ bind xK_braceleft $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. controlMask, xK_Up)
+
+ bind xK_braceright $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. controlMask, xK_Down)
+
+ bind xK_dollar $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. 0, xK_End)
+
+ bind xK_at $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. 0, xK_Home)
+
+ bind xK_w $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. shiftMask, xK_BackSpace)
+
+ bind xK_b $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. controlMask, xK_Left)
+
+ bind xK_e $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. controlMask, xK_Right)
+
+ bind xK_u $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. controlMask, xK_Page_Up)
+
+ bind xK_d $
+ rawMask (m .|. mod3Mask) $
+ emitKey (m .|. controlMask, xK_Page_Down)
+
configureIf (flip elem (browsers ++ spotify) <$> className) $ do
bind xK_h $ do
rawMask controlMask $ emitKey (0, xK_BackSpace)