aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-22 17:09:47 -0700
committerJosh Rahm <rahm@google.com>2021-11-22 17:09:47 -0700
commit0c8f4b67032a6bb226665bad60417f1007cd60ee (patch)
treeecf75aabf374b27d46e8ce8a84176287b9d20d41 /src
parent245e135bf003ca9420f21dc82727a9b9b4f0bdcf (diff)
downloadrde-0c8f4b67032a6bb226665bad60417f1007cd60ee.tar.gz
rde-0c8f4b67032a6bb226665bad60417f1007cd60ee.tar.bz2
rde-0c8f4b67032a6bb226665bad60417f1007cd60ee.zip
Mess with some other keybindings.
Diffstat (limited to 'src')
-rw-r--r--src/Internal/Keys.hs44
-rw-r--r--src/Internal/KeysM.hs10
2 files changed, 41 insertions, 13 deletions
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs
index 88b90dc..dec7f44 100644
--- a/src/Internal/Keys.hs
+++ b/src/Internal/Keys.hs
@@ -54,12 +54,12 @@ keymap = runKeys $ do
bind xK_apostrophe $ do
justMod $ subkeys $ do
bind xK_apostrophe $
- justMod jumpToLast
+ (noMod -|- justMod) jumpToLast
mapAlpha 0 jumpToMark
shiftMod $ subkeys $ do
bind xK_apostrophe $
- shiftMod swapWithLastMark
+ (noMod -|- shiftMod -|- rawMask shiftMask) swapWithLastMark
mapAlpha shiftMask swapWithMark
bind xK_BackSpace $ do
@@ -69,17 +69,28 @@ keymap = runKeys $ do
rawMask mod4Mask $ spawn "xterm"
justMod $ spawn "pkill -SIGUSR 1 xmobar"
- bind xK_F1 $
+ bind xK_F1 $ do
-- Button programmed on mouse
- shiftMod $ click >> withFocused (windows . W.sink)
+ rawMask shiftMask $ click >> withFocused (windows . W.sink)
+
+ shiftMod $ spawn "spotify-control play"
bind xK_F2 $
-- Button programmed on mouse
- shiftMod $ click >> sendMessage ToggleZoom
+ rawMask shiftMask $ click >> sendMessage ToggleZoom
bind xK_F3 $
-- Button programmed on mouse
- shiftMod $ click >> kill
+ rawMask shiftMask $ subkeys $ do
+
+ bind xK_F1 $ -- Make it harder to close so I don't accidentally git it.
+ rawMask shiftMask $ click >> kill
+
+ -- I Don't really use these, but they could be bound to something cool!
+ bind xK_F2 $
+ rawMask shiftMask $ spawn "spotify-control next"
+ bind xK_F3 $
+ rawMask shiftMask $ spawn "spotify-control prev"
bind xK_F10 $ do
justMod $ spawn "spotify-control play"
@@ -109,10 +120,10 @@ keymap = runKeys $ do
shiftMod $ withScreen W.shift idx
bind xK_bracketright $ do
- justMod $ sendMessage $ modifyWindowBorder (-1)
+ justMod $ sendMessage $ modifyWindowBorder 5
bind xK_bracketleft $ do
- justMod $ sendMessage $ modifyWindowBorder 1
+ justMod $ sendMessage $ modifyWindowBorder (-5)
bind xK_b $ do
justMod $ spawn "bluetooth-select.sh"
@@ -192,7 +203,18 @@ keymap = runKeys $ do
justMod $ sendMessage ToggleStruts
bind xK_z $ do
- justMod $ sendMessage ToggleZoom
+ justMod $ subkeys $ do
+ -- Z is reserved to create sub keybindings to do various things.
+ -- I don't really use these at the moment.
+ bind xK_h $ do
+ noMod $ spawn "spotify-control prev"
+
+ bind xK_l $ do
+ noMod $ spawn "spotify-control next"
+
+ -- Centers the current focused window. i.e. toggles the Zoom layout
+ -- modifier.
+ shiftMod $ sendMessage ToggleZoom
mouseMap :: ButtonsMap l
mouseMap = runButtons $ do
@@ -212,10 +234,10 @@ mouseMap = runButtons $ do
justMod $ const (relativeWorkspaceShift next)
bind (8 :: Button) $
- justMod $ const (relativeWorkspaceShift prev)
+ justMod $ const $ spawn "spotify-control prev"
bind (9 :: Button) $
- justMod $ const (relativeWorkspaceShift next)
+ justMod $ const $ spawn "spotify-control next"
applyKeys :: XConfig l -> IO (XConfig l)
applyKeys config@(XConfig {modMask = modm}) =
diff --git a/src/Internal/KeysM.hs b/src/Internal/KeysM.hs
index de48bee..0d7adce 100644
--- a/src/Internal/KeysM.hs
+++ b/src/Internal/KeysM.hs
@@ -43,8 +43,8 @@ instance HasConfig ButtonsM where
getConfig = fst <$> ButtonsM get
{- Generally it is assumed that the mod key shoud be pressed, but not always. -}
-naked :: f -> BindingBuilder f ()
-naked = rawMask 0
+noMod :: f -> BindingBuilder f ()
+noMod = rawMask 0
rawMask :: KeyMask -> f -> BindingBuilder f ()
rawMask m x = BindingBuilder $ modify' (second ((m, x):))
@@ -339,6 +339,12 @@ hyperMod = maskMod hyperMask
altgrMod :: f -> BindingBuilder f ()
altgrMod = maskMod altgrMask
+{- Can combine two or more of the functions above to apply the same action to
+ - multiple masks. -}
+(-|-) :: (f -> BindingBuilder f ()) ->
+ (f -> BindingBuilder f ()) ->
+ f -> BindingBuilder f ()
+(-|-) fn1 fn2 f = fn1 f >> fn2 f
{- Meant for submapping, binds all alphanumeric charactes to (fn c). -}
mapNumbersAndAlpha :: KeyMask -> (Char -> X ()) -> KeysM l ()