diff options
| -rw-r--r-- | src/Rahm/Desktop/Keys/Wml.hs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index a46bbac..4e63575 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -113,7 +113,7 @@ import Rahm.Desktop.XMobarLog.PendingBuffer ( addStringToPendingBuffer, setPendingBuffer, ) -import System.Exit (ExitCode (..), exitWith, exitSuccess) +import System.Exit (ExitCode (..), exitSuccess, exitWith) import Text.Printf (printf) import XMonad ( Default (def), @@ -336,7 +336,11 @@ readNextWorkspaceName = joinMaybe $ workspaceName <$> readNextWorkspace readNextWorkspace :: (KeyFeeder m) => MaybeT m Workspace readNextWorkspace = readNextKey $ \mask sym str -> do + macros <- (lift . fromX) $ workspaceMacros <$> XS.get + case (mask, sym, str) of + (mask, keysym, _) | (Just macro) <- Map.lookup (mask, keysym) macros -> do + fromMaybeTX $ workspaceForKeysT macro (_, e, _) | e == xK_Escape -> MaybeT $ return Nothing (_, _, [ch]) | isAlphaNum ch || ch == '*' -> return $ justWorkspace [ch] (_, _, "[") -> @@ -351,16 +355,23 @@ readNextWorkspace = ) (_, _, "(") -> justWorkspace - <$> (lift1 (adjacentWorkspace prev) =<< readNextWorkspaceName) + <$> ( lift1 (adjacentWorkspace prev) + =<< readNextWorkspaceName + ) (_, _, ")") -> justWorkspace - <$> (lift1 (adjacentWorkspace next) =<< readNextWorkspaceName) + <$> ( lift1 (adjacentWorkspace next) + =<< readNextWorkspaceName + ) (_, _, "^") -> mapMaybeT fromX $ MaybeT $ withWindowSet $ \ws -> return $ - (fmap (justWorkspace . W.tag . W.workspace . snd) . head) - (getHorizontallyOrderedScreens ws) + ( fmap + ( justWorkspace . W.tag . W.workspace . snd + ) + . head + ) (getHorizontallyOrderedScreens ws) (_, _, "'") -> fromMaybeTX $ justWorkspace . locationWorkspace <$> MaybeT lastLocation (_, _, ".") -> mt $ justWorkspace <$> getCurrentWorkspace (_, _, "$") -> MaybeT $ @@ -430,9 +441,6 @@ readNextWorkspace = if null l1 then ws2 else ws1 - (mask, keysym, _) -> do - macro <- (MaybeT . fromX) (Map.lookup (mask, keysym) . workspaceMacros <$> XS.get) - fromMaybeTX $ workspaceForKeysT macro where mt :: (KeyFeeder m) => X a -> MaybeT m a mt = lift . fromX |