aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-08-02 12:23:45 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:46 -0600
commit2ba96e5577f2f0b71a2aecffe4f6d8762de47442 (patch)
tree79c4cbb67322993fbf491427551b29545dd90449
parent96c8d655adbb3ecc93597365657bb47695e5fb10 (diff)
downloadrde-2ba96e5577f2f0b71a2aecffe4f6d8762de47442.tar.gz
rde-2ba96e5577f2f0b71a2aecffe4f6d8762de47442.tar.bz2
rde-2ba96e5577f2f0b71a2aecffe4f6d8762de47442.zip
Add more Wml adjectives.
These are: '~ws' - Associated workspace, which is the workspace of the toggled case. I.e. workspace ~w == W, or ~. is the toggled case of the current workspace. '=ws₀ws₁ws₂ws₃' ws₂ if name(ws₀) == name(ws₁) otherwise ws₃ while not _that_ helpful for interactive usage, it is useful for programming macros. I.e. to jump to Spotify, unless I'm already on spotify, in which case go back to where I was, I can record this macro on my keyboard: <Hyper-g>=.s's or a macro to jump back and forth between the current workspace and the associated workspace on the next monitor: <Hyper-g>=.~,.'~,.
-rw-r--r--src/Rahm/Desktop/Keys/Wml.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs
index af04e44..adb1d9f 100644
--- a/src/Rahm/Desktop/Keys/Wml.hs
+++ b/src/Rahm/Desktop/Keys/Wml.hs
@@ -273,8 +273,27 @@ readNextWorkspace =
justWorkspace . accompaningWorkspace <$> readNextWorkspaceName
(_, _, " ") -> mt $
justWorkspace . accompaningWorkspace <$> getCurrentWorkspace
+ (_, _, "~") -> do
+ ws <- readNextWorkspace
+ case workspaceName ws of
+ Just [a] | isAlphaNum a ->
+ return (justWorkspace $ accompaningWorkspace [a])
+ _ -> MaybeT (return Nothing)
+
(_, _, "_") -> return blackHoleWorkspace
(_, _, "-") -> return alternateWorkspace
+ (_, _, "=") -> do
+ ws1 <- readNextWorkspace
+ ws2 <- readNextWorkspace
+
+ ws3 <- readNextWorkspace
+ ws4 <- readNextWorkspace
+
+ return $
+ if workspaceName ws1 == workspaceName ws2
+ then ws3
+ else ws4
+
(mask, keysym, _) -> do
macro <- (MaybeT . fromX) (Map.lookup (mask, keysym) . workspaceMacros <$> XS.get)
fromMaybeTX $ workspaceForKeysT macro