0
I want to have 9 workspaces as a grid. And to navigate them using the arrow-keys. So far I can navigate with the arrow-keys, but I want to get rid of the "wrap-around". For example, if workspace 9 is the current workspace and I press arrow UP, I end up with workspace 1(should stay on workspace 9). This should be no problem to implement if there is a way to get the current workspace.
Here is some of my code so far:
myKeys = [
, ((myModMask , xK_Down), (switchWorkspace (-3))) -- prevWS
, ((myModMask , xK_Up), (switchWorkspace 3)) -- nextWS
, ((myModMask , xK_Left), prevWS)
, ((myModMask , xK_Right), nextWS)
]
switchWorkspace :: Int -> X ()
switchWorkspace d = wsBy d >>= windows . W.greedyView
wsBy :: Int -> X (WorkspaceId)
wsBy = findWorkspace C.getSortByIndex Next AnyWS
I found this code below which might be useful but don't know how to "extract" the result or if the result is useful? How do I get the current workspace? Thank you.
-- | Lookup the index of a workspace id in the user's config, return Nothing
-- if that workspace does not exist in the config.
getWsIndex :: X (WorkspaceId -> Maybe Int)
getWsIndex = do
spaces <- asks (workspaces . config)
return $ flip elemIndex spaces