{-# LANGUAGE DeriveDataTypeable #-}------------------------------------------------------------------------------ |-- Module : XMonad.Hooks.CurrentWorkspaceOnTop-- Copyright : (c) Jan Vornberger 2009-- License : BSD3-style (see LICENSE)---- Maintainer : jan.vornberger@informatik.uni-oldenburg.de-- Stability : unstable-- Portability : not portable---- Ensures that the windows of the current workspace are always in front-- of windows that are located on other visible screens. This becomes important-- if you use decoration and drag windows from one screen to another. Using this-- module, the dragged window will always be in front of other windows.-------------------------------------------------------------------------------moduleXMonad.Hooks.CurrentWorkspaceOnTop(-- * Usage-- $usagecurrentWorkspaceOnTop)whereimportXMonadimportqualifiedXMonad.StackSetasSimportqualifiedXMonad.Util.ExtensibleStateasXSimportControl.Monad(when)-- $usage-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:---- > import XMonad.Hooks.CurrentWorkspaceOnTop-- >-- > main = xmonad $ defaultConfig {-- > ...-- > logHook = currentWorkspaceOnTop-- > ...-- > }--dataCWOTState=CWOTSStringderivingTypeableinstanceExtensionClassCWOTStatewhereinitialValue=CWOTS""currentWorkspaceOnTop::X()currentWorkspaceOnTop=withDisplay$\d->dows<-getswindowset(CWOTSlastTag)<-XS.getletcurTag=S.tag.S.workspace.S.current$wswhen(curTag/=lastTag)$dolets=S.currentwswsp=S.workspacesviewrect=screenRect$S.screenDetailstmpStack=S.stack.S.workspace$s(rs,_)<-runLayoutwsp{S.stack=tmpStack}viewrectletwins=mapfstrswhen(not.null$wins)$doio$raiseWindowd(headwins)-- raise first window of current workspace to the very top,io$restackWindowsdwins-- then use restackWindows to let all other windows from the workspace followXS.put(CWOTScurTag)