From 363314e16a5a39f21e34b0ff4ae0532f444be978 Mon Sep 17 00:00:00 2001 From: David Roundy Date: Fri, 29 Feb 2008 23:30:47 +0100 Subject: in Prompt.Workspace sort by official workspace order. darcs-hash:20080229223047-72aca-f66c6583d8be77207a3f083fe26be40f1f02e4b5.gz --- XMonad/Actions/DynamicWorkspaces.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'XMonad/Actions/DynamicWorkspaces.hs') diff --git a/XMonad/Actions/DynamicWorkspaces.hs b/XMonad/Actions/DynamicWorkspaces.hs index 17506aa..bf28091 100644 --- a/XMonad/Actions/DynamicWorkspaces.hs +++ b/XMonad/Actions/DynamicWorkspaces.hs @@ -22,12 +22,11 @@ module XMonad.Actions.DynamicWorkspaces ( toNthWorkspace, withNthWorkspace ) where -import Data.List ( sort ) - import XMonad hiding (workspaces) import XMonad.StackSet hiding (filter, modify, delete) import XMonad.Prompt.Workspace import XMonad.Prompt ( XPConfig, mkXPrompt, XPrompt(..) ) +import XMonad.Util.WorkspaceCompare ( getSortByIndex ) -- $usage -- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file: @@ -63,7 +62,8 @@ mkCompl l s = return $ filter (\x -> take (length s) x == s) l withWorkspace :: XPConfig -> (String -> X ()) -> X () withWorkspace c job = do ws <- gets (workspaces . windowset) - let ts = sort $ map tag ws + sort <- getSortByIndex + let ts = map tag $ sort ws job' t | t `elem` ts = job t | otherwise = addHiddenWorkspace t >> job t mkXPrompt (Wor "") c (mkCompl ts) job' @@ -76,13 +76,15 @@ renameWorkspace conf = workspacePrompt conf $ \w -> in sets $ removeWorkspace' w s toNthWorkspace :: (String -> X ()) -> Int -> X () -toNthWorkspace job wnum = do ws <- gets (sort . map tag . workspaces . windowset) +toNthWorkspace job wnum = do sort <- getSortByIndex + ws <- gets (map tag . sort . workspaces . windowset) case drop wnum ws of (w:_) -> job w [] -> return () withNthWorkspace :: (String -> WindowSet -> WindowSet) -> Int -> X () -withNthWorkspace job wnum = do ws <- gets (sort . map tag . workspaces . windowset) +withNthWorkspace job wnum = do sort <- getSortByIndex + ws <- gets (map tag . sort . workspaces . windowset) case drop wnum ws of (w:_) -> windows $ job w [] -> return () -- cgit v1.2.3