aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/Keys.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-04-15 23:55:35 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-04-15 23:55:35 -0600
commit7a5051f7955a8b4e69b2c28b5a9b34f9730e21f0 (patch)
tree27eb1b5f660bfedea78ce0b26f52aede2460fa96 /src/Rahm/Desktop/Keys.hs
parent588e87efb099927fda713380e5bf64e8c7f1fdcd (diff)
downloadrde-7a5051f7955a8b4e69b2c28b5a9b34f9730e21f0.tar.gz
rde-7a5051f7955a8b4e69b2c28b5a9b34f9730e21f0.tar.bz2
rde-7a5051f7955a8b4e69b2c28b5a9b34f9730e21f0.zip
Make history much, much more reliable.
This time history is being done using a hook to keep track of history. This means I don't have to manually call pushHistory every time I focus a new window.
Diffstat (limited to 'src/Rahm/Desktop/Keys.hs')
-rw-r--r--src/Rahm/Desktop/Keys.hs39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index d302b59..ebc8b7f 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -62,6 +62,7 @@ import Rahm.Desktop.Swallow
import Rahm.Desktop.SwapMaster (swapMaster)
import Rahm.Desktop.Windows
import Rahm.Desktop.Workspaces
+import Rahm.Desktop.History
type KeyMap l = XConfig l -> Map (KeyMask, KeySym) (X ())
type ButtonsMap l = XConfig l -> Map (KeyMask, Button) (Window -> X ())
@@ -143,10 +144,10 @@ keymap = runKeys $ do
doc "Jumps between marks." $
mapNextString $ \_ str ->
case str of
- ['\''] -> jumpToLast
+ ['\''] -> jumpToLastLocation
[ch] | isAlphaNum ch -> jumpToMark ch
- "[" -> historyPrev
- "]" -> historyNext
+ "[" -> historyBack
+ "]" -> historyForward
_ -> return ()
shiftMod $
@@ -162,7 +163,7 @@ keymap = runKeys $ do
doc "Swap the current window with a mark." $
mapNextString $ \_ str ->
case str of
- ['\''] -> swapWithLastMark
+ -- ['\''] -> swapWithLastMark
[ch] | isAlphaNum ch -> swapWithMark ch
_ -> return ()
@@ -315,7 +316,7 @@ keymap = runKeys $ do
\F1: display this help.\n\n\t" $
mapNextStringWithKeysym $ \_ keysym str ->
case ((keysym, str), selectWorkspace (keysym, str)) of
- (_, Just w) -> pushHistory $ gotoWorkspace =<< w
+ (_, Just w) -> gotoWorkspace =<< w
-- Test binding. Tests that I can still submap keysyms alone (keys
-- where XLookupString won't return anything helpful.)
((f, _), _) | f == xK_F1 ->
@@ -336,7 +337,7 @@ keymap = runKeys $ do
doc "Move the current focused window to another workspace and view that workspace" $
mapNextStringWithKeysym $ \_ keysym str ->
case ((keysym, str), selectWorkspace (keysym, str)) of
- (_, Just w) -> pushHistory $ do
+ (_, Just w) -> do
ws <- w
shiftToWorkspace ws
gotoWorkspace ws
@@ -377,7 +378,7 @@ keymap = runKeys $ do
sendMessage Shrink
shiftMod $
- doc "Go to the previous window in history." historyPrev
+ doc "Go to the previous window in history." historyBack
bind xK_k $ do
justMod $
@@ -385,7 +386,7 @@ keymap = runKeys $ do
sendMessage Expand
shiftMod $
- doc "Go to the next window in history." historyNext
+ doc "Go to the next window in history." historyForward
bind xK_l $ do
justMod $
@@ -551,7 +552,7 @@ keymap = runKeys $ do
bind xK_p $ do
(justMod -|- noMod) $
- doc "Go to the prior window in the history" historyPrev
+ doc "Go to the prior window in the history" historyBack
bind xK_t $ do
(justMod -|- noMod) $ logs "Test Log"
@@ -562,7 +563,7 @@ keymap = runKeys $ do
-- spawnX (terminal config ++ " -t Notes -e notes new")
bind xK_n $ do
(justMod -|- noMod) $
- doc "Go to the next window in the history" historyNext
+ doc "Go to the next window in the history" historyForward
bind xK_c $ do
shiftMod $
@@ -606,6 +607,18 @@ keymap = runKeys $ do
doc "Set the volume of an application via rofi." $
spawnX "set-volume.sh -a"
+ let navigateHistory = repeatable $ do
+ bind xK_bracketright $ do
+ noMod $
+ doc "Move forward in location history" historyForward
+
+ bind xK_bracketleft $ do
+ noMod $
+ doc "Move backward in location history" historyBack
+
+ bind xK_bracketleft $ noMod navigateHistory
+ bind xK_bracketright $ noMod navigateHistory
+
-- Double-tap Z to toggle zoom.
bind xK_z $ do
noMod -|- justMod $
@@ -723,8 +736,8 @@ mouseMap = runButtons $ do
(button4, increaseVolume),
(button5, decreaseVolume),
(button2, playPause),
- (button9, historyNext),
- (button8, historyPrev),
+ (button9, historyForward),
+ (button8, historyBack),
(button6, mediaPrev),
(button7, mediaNext)
]
@@ -760,7 +773,7 @@ mouseMap = runButtons $ do
gotoWorkspace =<< (accompaningWorkspace <$> getCurrentWorkspace)
bind button15 $ do
- noMod $ noWindow jumpToLast
+ noMod $ noWindow jumpToLastLocation
let workspaceButtons = [