aboutsummaryrefslogtreecommitdiffstats
path: root/RotView.hs
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-05-10 03:20:59 +0200
committerJason Creighton <jcreigh@gmail.com>2007-05-10 03:20:59 +0200
commit7c37e6463f860d01cfb0c12b91e5f2ab1c7589c5 (patch)
tree70805aae9a3db0ab9650020c587c2cbc68287856 /RotView.hs
parentfa0408952d0a0f36f6590dd46dd4329d6b16798d (diff)
downloadXMonadContrib-7c37e6463f860d01cfb0c12b91e5f2ab1c7589c5.tar.gz
XMonadContrib-7c37e6463f860d01cfb0c12b91e5f2ab1c7589c5.tar.xz
XMonadContrib-7c37e6463f860d01cfb0c12b91e5f2ab1c7589c5.zip
make rotView only consider non-visible workspaces (Xinerama)
darcs-hash:20070510012059-b9aa7-ac8a3d1bbca392324b1308315f5293470cc79b54.gz
Diffstat (limited to 'RotView.hs')
-rw-r--r--RotView.hs23
1 files changed, 13 insertions, 10 deletions
diff --git a/RotView.hs b/RotView.hs
index 9d53cc4..7505bb2 100644
--- a/RotView.hs
+++ b/RotView.hs
@@ -12,21 +12,24 @@ import qualified Data.Map as M
import Control.Monad.State
import Operations ( view )
-import XMonad ( X, WorkspaceId, workspace )
-import StackSet ( StackSet, focus )
-import qualified StackSet as W ( current )
+import XMonad ( X, WorkspaceId, workspace, whenJust )
+import StackSet ( StackSet )
+import Data.Maybe ( listToMaybe )
+import qualified StackSet as W ( stacks, current, visibleWorkspaces, index )
rotView :: Bool -> X ()
rotView b = do ws <- gets workspace
let m = W.current ws
+ vis = W.visibleWorkspaces ws
allws = if b then allWorkspaces ws else reverse $ allWorkspaces ws
- n1 = safehead allws m
- rot (f:fs) | f == m = safehead fs n1
- | otherwise = rot fs
- rot [] = n1
- safehead fs f = case fs of { [] -> f; f':_ -> f'; }
- view (rot allws)
+ pivoted = uncurry (flip (++)) . span (/=m) $ allws
+ interesting i = not (i `elem` vis) && not (isEmpty i ws)
+ nextws = listToMaybe . filter interesting $ pivoted
+ whenJust nextws view
-- | A list of all the workspaces.
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