make rotView only consider non-visible workspaces (Xinerama)

This commit is contained in:
Jason Creighton 2007-05-10 01:20:59 +00:00
parent f8a5f1fd2b
commit 40f8d611f2

View File

@ -12,21 +12,24 @@ import qualified Data.Map as M
import Control.Monad.State import Control.Monad.State
import Operations ( view ) import Operations ( view )
import XMonad ( X, WorkspaceId, workspace ) import XMonad ( X, WorkspaceId, workspace, whenJust )
import StackSet ( StackSet, focus ) import StackSet ( StackSet )
import qualified StackSet as W ( current ) import Data.Maybe ( listToMaybe )
import qualified StackSet as W ( stacks, current, visibleWorkspaces, index )
rotView :: Bool -> X () rotView :: Bool -> X ()
rotView b = do ws <- gets workspace rotView b = do ws <- gets workspace
let m = W.current ws let m = W.current ws
vis = W.visibleWorkspaces ws
allws = if b then allWorkspaces ws else reverse $ allWorkspaces ws allws = if b then allWorkspaces ws else reverse $ allWorkspaces ws
n1 = safehead allws m pivoted = uncurry (flip (++)) . span (/=m) $ allws
rot (f:fs) | f == m = safehead fs n1 interesting i = not (i `elem` vis) && not (isEmpty i ws)
| otherwise = rot fs nextws = listToMaybe . filter interesting $ pivoted
rot [] = n1 whenJust nextws view
safehead fs f = case fs of { [] -> f; f':_ -> f'; }
view (rot allws)
-- | A list of all the workspaces. -- | A list of all the workspaces.
allWorkspaces :: StackSet WorkspaceId j a -> [WorkspaceId] allWorkspaces :: StackSet WorkspaceId j a -> [WorkspaceId]
allWorkspaces = M.keys . focus allWorkspaces = M.keys . W.stacks
isEmpty :: WorkspaceId -> StackSet WorkspaceId j a -> Bool
isEmpty i = maybe True null . W.index i