make DwmPromote compile

This commit is contained in:
Miikka Koskinen 2007-05-21 12:31:40 +00:00
parent 32bb8aa154
commit c39da512e9

View File

@ -8,7 +8,7 @@
-- --
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- --
-- Dwm-like promote function for xmonad. -- Dwm-like swap function for xmonad.
-- --
-- Swaps focused window with the master window. If focus is in the -- Swaps focused window with the master window. If focus is in the
-- master, swap it with the next window in the stack. Focus stays in the -- master, swap it with the next window in the stack. Focus stays in the
@ -27,20 +27,13 @@ module XMonadContrib.DwmPromote (dwmpromote) where
import XMonad import XMonad
import Operations (windows) import Operations (windows)
import StackSet hiding (promote) import StackSet hiding (swap)
import qualified Data.Map as M import qualified Data.Map as M
dwmpromote :: X () dwmpromote :: X ()
dwmpromote = windows promote dwmpromote = windows swap
promote :: (Integral i, Integral j, Ord a) => StackSet i j a -> StackSet i j a swap :: StackSet i a s -> StackSet i a s
promote w = maybe w id $ do swap = modify Empty $ \c -> case c of
a <- peek w -- fail if null Node t [] (x:rs) -> Node x [] (t:rs)
stack <- index (current w) w Node t ls rs -> Node t [] (ys ++ x : rs) where (x:ys) = reverse ls
let newstack = swap a (next stack a) stack
return . raiseFocus (head newstack) $
w { stacks = M.adjust (\(f,_) -> (f, newstack)) (current w) (stacks w) }
where
next s a | head s /= a = head s -- focused is not master
| length s > 1 = s !! 1
| otherwise = a