diff options
| author | Josh Rahm <rahm@google.com> | 2022-08-03 16:04:48 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:46 -0600 |
| commit | da91b5793c1eb39d936e9e92725de5818e3af935 (patch) | |
| tree | e76c437eaca83b33e2aff404efb87d48a0bcc686 /src/Rahm/Desktop/Keys | |
| parent | 2375862e26e09aae01da73fe7bf056ae571061d8 (diff) | |
| download | rde-da91b5793c1eb39d936e9e92725de5818e3af935.tar.gz rde-da91b5793c1eb39d936e9e92725de5818e3af935.tar.bz2 rde-da91b5793c1eb39d936e9e92725de5818e3af935.zip | |
Add preferred window for some Workspace jumps.
The wml workspace @w refers to the workspace that contains the window
marked 'w', however when jumping to that workspace, an arbitrary window
is focused. It's more intuitive to set focus to the window 'w'. This
means that <H-g>@• is the same as <H-w>•.
Diffstat (limited to 'src/Rahm/Desktop/Keys')
| -rw-r--r-- | src/Rahm/Desktop/Keys/Wml.hs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 34dabd2..d6289bd 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -94,6 +94,22 @@ justWorkspace s = , extraWorkspaceData = () } +justWorkspaceWithPreferredWindow :: Window -> String -> Workspace +justWorkspaceWithPreferredWindow w s = + Workspace { + moveLocationToWorkspaceFn = flip moveLocationToWorkspace s + , gotoWorkspaceFn = do + windows $ \ws' -> + let ws = W.greedyView s ws' + l = W.integrate' $ W.stack $ W.workspace $ W.current ws in + if w `elem` l + then W.focusWindow w ws + else ws + + , workspaceName = Just s + , extraWorkspaceData = () + } + blackHoleWorkspace :: Workspace blackHoleWorkspace = Workspace { @@ -272,7 +288,7 @@ readNextWorkspace = MaybeT $ fromX $ withWindowSet $ \ws -> return $ do win <- locationWindow =<< head loc winLocation <- W.findWindow ws win - (justWorkspace . W.tag) <$> W.getLocationWorkspace winLocation + (justWorkspaceWithPreferredWindow win . W.tag) <$> W.getLocationWorkspace winLocation (_, _, "~") -> justWorkspace . accompaningWorkspace <$> readNextWorkspaceName |