From 2ba96e5577f2f0b71a2aecffe4f6d8762de47442 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 2 Aug 2022 12:23:45 -0600 Subject: Add more Wml adjectives. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: =.s's or a macro to jump back and forth between the current workspace and the associated workspace on the next monitor: =.~,.'~,. --- src/Rahm/Desktop/Keys/Wml.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/Rahm/Desktop/Keys') 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 -- cgit