diff options
author | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-11-01 09:44:31 +0100 |
---|---|---|
committer | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-11-01 09:44:31 +0100 |
commit | bc4f1660b11f3f3eed4bd7170a30f7c015da026c (patch) | |
tree | 7cffda729c41d6e1ffccd4d5ababab04f5766928 | |
parent | ec681dcb8e6b5ff5d120cee8d9f1574e4dc09eea (diff) | |
download | XMonadContrib-bc4f1660b11f3f3eed4bd7170a30f7c015da026c.tar.gz XMonadContrib-bc4f1660b11f3f3eed4bd7170a30f7c015da026c.tar.xz XMonadContrib-bc4f1660b11f3f3eed4bd7170a30f7c015da026c.zip |
Port CycleWS
darcs-hash:20071101084431-a5988-5a82fc35b25fc43e76bb0bba2a2349775924f153.gz
-rw-r--r-- | CycleWS.hs | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -24,15 +24,16 @@ module XMonadContrib.CycleWS ( toggleWS, ) where +import Control.Monad.Reader ( asks ) import Control.Monad.State ( gets ) import Data.List ( sortBy, findIndex ) import Data.Maybe ( fromMaybe ) import Data.Ord ( comparing ) -import XMonad +import XMonad hiding (workspaces) +import qualified XMonad (workspaces) import StackSet hiding (filter) import Operations -import {-# SOURCE #-} qualified Config (workspaces) -- $usage -- You can use this module with the following in your Config.hs file: @@ -88,13 +89,14 @@ shiftBy d = wsBy d >>= windows . shift wsBy :: Int -> X (WorkspaceId) wsBy d = do ws <- gets windowset - let orderedWs = sortBy (comparing wsIndex) (workspaces ws) + spaces <- asks (XMonad.workspaces . config) + let orderedWs = sortBy (comparing (wsIndex spaces)) (workspaces ws) let now = fromMaybe 0 $ findWsIndex (workspace (current ws)) orderedWs let next = orderedWs !! ((now + d) `mod` length orderedWs) return $ tag next -wsIndex :: WindowSpace -> Maybe Int -wsIndex ws = findIndex (== tag ws) Config.workspaces +wsIndex :: [WorkspaceId] -> WindowSpace -> Maybe Int +wsIndex spaces ws = findIndex (== tag ws) spaces findWsIndex :: WindowSpace -> [WindowSpace] -> Maybe Int findWsIndex ws wss = findIndex ((== tag ws) . tag) wss |