From 5217c7c613b3559c65db9de11aec1b744df062cb Mon Sep 17 00:00:00 2001 From: Jan Vornberger Date: Tue, 27 Jul 2010 21:41:54 +0200 Subject: CurrentWorkspaceOnTop: proper reimplementation of XMonad.Operation Ignore-this: 101f55913bf836d1d87863b4c05d0665 Fixes bugs in combination with stateful layouts and floating windows darcs-hash:20100727194154-594c5-09624ed36bbbf81e245d827497a49897043a928d.gz --- XMonad/Hooks/CurrentWorkspaceOnTop.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'XMonad/Hooks/CurrentWorkspaceOnTop.hs') diff --git a/XMonad/Hooks/CurrentWorkspaceOnTop.hs b/XMonad/Hooks/CurrentWorkspaceOnTop.hs index 638a963..2c42413 100644 --- a/XMonad/Hooks/CurrentWorkspaceOnTop.hs +++ b/XMonad/Hooks/CurrentWorkspaceOnTop.hs @@ -26,6 +26,7 @@ import XMonad import qualified XMonad.StackSet as S import qualified XMonad.Util.ExtensibleState as XS import Control.Monad(when) +import qualified Data.Map as M -- $usage -- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@: @@ -50,12 +51,18 @@ currentWorkspaceOnTop = withDisplay $ \d -> do (CWOTS lastTag) <- XS.get let curTag = S.tag . S.workspace . S.current $ ws when (curTag /= lastTag) $ do + -- the following is more or less a reimplementation of what's happening in "XMonad.Operation" let s = S.current ws wsp = S.workspace s viewrect = screenRect $ S.screenDetail s - tmpStack = S.stack . S.workspace $ s - (rs, _) <- runLayout wsp { S.stack = tmpStack } viewrect - let wins = map fst rs + tmpStack = (S.stack wsp) >>= S.filter (`M.notMember` S.floating ws) + (rs, ml') <- runLayout wsp { S.stack = tmpStack } viewrect + updateLayout curTag ml' + let this = S.view curTag ws + fltWins = filter (flip M.member (S.floating ws)) $ S.index this + wins = fltWins ++ (map fst rs) -- order: first all floating windows, then the order the layout returned + -- end of reimplementation + when (not . null $ wins) $ do io $ raiseWindow d (head wins) -- raise first window of current workspace to the very top, io $ restackWindows d wins -- then use restackWindows to let all other windows from the workspace follow -- cgit v1.2.3