aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-04-14 23:09:50 -0600
committerJosh Rahm <rahm@google.com>2022-04-14 23:09:50 -0600
commita14486b47a51e772a3b230bc82390cb667f2ecd5 (patch)
tree1d95cc48e15cef992dc0ef217b6dd64cc3572347 /src
parent643642e5e76fd5278a26f560dca60e5b18ac8933 (diff)
downloadrde-a14486b47a51e772a3b230bc82390cb667f2ecd5.tar.gz
rde-a14486b47a51e772a3b230bc82390cb667f2ecd5.tar.bz2
rde-a14486b47a51e772a3b230bc82390cb667f2ecd5.zip
Some changes to marking
Diffstat (limited to 'src')
-rw-r--r--src/Rahm/Desktop/Keys.hs9
-rw-r--r--src/Rahm/Desktop/Marking.hs7
2 files changed, 15 insertions, 1 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index fec7ce5..d302b59 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -150,6 +150,15 @@ keymap = runKeys $ do
_ -> return ()
shiftMod $
+ doc "Move the marked windo to the current workspace." $
+ mapNextString $ \_ str ->
+ case str of
+ [ch] | isAlphaNum ch -> do
+ ws <- getCurrentWorkspace
+ maybe (return ()) (windows . W.shiftWin ws) =<< markToWindow ch
+ _ -> return ()
+
+ controlMod $
doc "Swap the current window with a mark." $
mapNextString $ \_ str ->
case str of
diff --git a/src/Rahm/Desktop/Marking.hs b/src/Rahm/Desktop/Marking.hs
index 1144ad7..98c96bb 100644
--- a/src/Rahm/Desktop/Marking.hs
+++ b/src/Rahm/Desktop/Marking.hs
@@ -2,7 +2,7 @@ module Rahm.Desktop.Marking (
historyNext, historyPrev,
markCurrentWindow, pushHistory,
jumpToMark, jumpToLast, swapWithLastMark,
- swapWithMark
+ swapWithMark, markToWindow
) where
import Rahm.Desktop.Windows (mapWindows, findWindow, getLocationWorkspace)
@@ -185,6 +185,11 @@ swapWithLastMark = pushHistory $ withHistory $ \hist -> do
windows $ swapWithFocused win
Nothing -> return ()
+markToWindow :: Mark -> X (Maybe Window)
+markToWindow m = do
+ MarkState { markStateMap = mp } <- XS.get
+ return $ Map.lookup m mp
+
swapWithMark :: Mark -> X ()
swapWithMark mark = pushHistory $ do
MarkState {markStateMap = m} <- XS.get