From 983db9f0cd1d0e4e7e26f53554c6aa368fabef05 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sun, 22 Feb 2026 22:55:55 -0700 Subject: [fix] - Make the up/down/left/right workspace navigation robust. --- src/Rahm/Desktop/Keys/Wml.hs | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) (limited to 'src/Rahm/Desktop/Keys') diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 19538fc..e5c45e7 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -480,11 +480,11 @@ readNextWorkspace = case key of (mask, keysym, _) | (Just macro) <- Map.lookup (mask, keysym) macros -> do - pushKeys macro - readNextWorkspace + pushKeys macro + readNextWorkspace (_, _, [ch]) | isAlphaNum ch || ch == '*' -> - return $ justWorkspace [ch] + return $ justWorkspace [ch] (_, _, "[") -> justWorkspace <$> ( lift1 (adjacentWorkspaceNotVisible prev) @@ -538,36 +538,23 @@ readNextWorkspace = floatWorkspace <$> readNextWorkspace -- Workspace to the next screen to the right of the next workspace. (_, _, ",") -> do - ws <- readNextWorkspace - screens <- - liftXToFeed $ - map (W.tag . W.workspace . snd) - <$> withWindowSet (return . getScreensOnSamePlane) + ws <- readNextWorkspaceName + liftXToFeed $ justWorkspace <$> getWorkspaceToTheRight ws - let (_, rest) = break ((== workspaceName ws) . Just) (screens ++ screens) - - justWorkspace <$> hoistMaybe (head $ tail rest) + -- Workspace on the screen below the current workspace.. + (_, _, "%") -> do + ws <- readNextWorkspaceName + liftXToFeed $ justWorkspace <$> getWorkspaceAbove ws -- Workspace on the screen above the current workspace.. (_, _, "+") -> do - screens <- - liftXToFeed $ - map (W.tag . W.workspace . snd) - <$> withWindowSet (return . getScreensOnDifferentPlane) - - justWorkspace <$> hoistMaybe (head screens) + ws <- readNextWorkspaceName + liftXToFeed $ justWorkspace <$> getWorkspaceAbove ws -- Workspace to the next screen to the left of the next workspace. (_, _, ";") -> do - ws <- readNextWorkspace - screens <- - liftXToFeed $ - map (W.tag . W.workspace . snd) - <$> withWindowSet (return . reverse . getHorizontallyOrderedScreens) - - let (_, rest) = break ((== workspaceName ws) . Just) (screens ++ screens) - - justWorkspace <$> hoistMaybe (head $ tail rest) + ws <- readNextWorkspaceName + liftXToFeed $ justWorkspace <$> getWorkspaceToTheLeft ws -- The workspace with the searched for window. (_, _, "/") -> @@ -695,7 +682,7 @@ readNextLocationSet' = -- Windows in a workspace (_, _, s) | s == "\t" || s == "@" || s == "\n" -> - (liftXToFeed . workspaceWindows) =<< readNextWorkspace + (liftXToFeed . workspaceWindows) =<< readNextWorkspace -- The first window in the next window set. (_, _, "!") -> (: []) <$> absorbMaybe (head <$> readNextLocationSet) -- The windows except the first in a window set. -- cgit