fix selectWorkspace to work with new config.

This commit is contained in:
David Roundy 2007-11-01 18:35:46 +00:00
parent cd1884466a
commit c2a4c05faf

View File

@ -21,10 +21,11 @@ module XMonad.Actions.DynamicWorkspaces (
toNthWorkspace, withNthWorkspace toNthWorkspace, withNthWorkspace
) where ) where
import Control.Monad.Reader ( asks )
import Control.Monad.State ( gets ) import Control.Monad.State ( gets )
import Data.List ( sort ) import Data.List ( sort )
import XMonad ( X, XState(..), Layout, WorkspaceId, WindowSet ) import XMonad ( X, XState(..), Layout, WorkspaceId, WindowSet, config, layoutHook )
import XMonad.Operations import XMonad.Operations
import XMonad.StackSet hiding (filter, modify, delete) import XMonad.StackSet hiding (filter, modify, delete)
import Graphics.X11.Xlib ( Window ) import Graphics.X11.Xlib ( Window )
@ -36,7 +37,7 @@ import XMonad.Prompt ( XPConfig )
-- --
-- > import XMonad.Actions.DynamicWorkspaces -- > import XMonad.Actions.DynamicWorkspaces
-- --
-- > , ((modMask .|. shiftMask, xK_n), selectWorkspace defaultXPConfig layoutHook) -- > , ((modMask .|. shiftMask, xK_n), selectWorkspace defaultXPConfig)
-- > , ((modMask .|. shiftMask, xK_BackSpace), removeWorkspace) -- > , ((modMask .|. shiftMask, xK_BackSpace), removeWorkspace)
-- > , ((modMask .|. shiftMask .|. controlMask, xK_r), renameWorkspace defaultXPConfig) -- > , ((modMask .|. shiftMask .|. controlMask, xK_r), renameWorkspace defaultXPConfig)
-- --
@ -69,11 +70,12 @@ withNthWorkspace job wnum = do ws <- gets (sort . map tag . workspaces . windows
(w:_) -> windows $ job w (w:_) -> windows $ job w
[] -> return () [] -> return ()
selectWorkspace :: XPConfig -> Layout Window -> X () selectWorkspace :: XPConfig -> X ()
selectWorkspace conf l = workspacePrompt conf $ \w -> selectWorkspace conf = workspacePrompt conf $ \w ->
windows $ \s -> if tagMember w s do l <- asks (layoutHook . config)
then greedyView w s windows $ \s -> if tagMember w s
else addWorkspace' w l s then greedyView w s
else addWorkspace' w l s
addWorkspace :: Layout Window -> X () addWorkspace :: Layout Window -> X ()
addWorkspace l = do s <- gets windowset addWorkspace l = do s <- gets windowset