From abaa7dd71f899ad058c7f1c0544fa7c5f0468c0e Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Mon, 4 Feb 2008 06:33:36 +0100 Subject: Rename runManageHook to runQuery darcs-hash:20080204053336-a5988-0c8760f33f319acd30cd18630ada2b77a0875a5b --- XMonad/Core.hs | 6 +++--- XMonad/Operations.hs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'XMonad') diff --git a/XMonad/Core.hs b/XMonad/Core.hs index feeae6e..253e3fe 100644 --- a/XMonad/Core.hs +++ b/XMonad/Core.hs @@ -27,7 +27,7 @@ module XMonad.Core ( runX, catchX, userCode, io, catchIO, doubleFork, withDisplay, withWindowSet, isRoot, runOnWorkspaces, broadcastMessage, getAtom, spawn, restart, getXMonadDir, recompile, trace, whenJust, whenX, - atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runManageHook + atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runQuery ) where import XMonad.StackSet hiding (modify) @@ -131,8 +131,8 @@ newtype Query a = Query (ReaderT Window X a) deriving (Functor, Monad, MonadReader Window, MonadIO) #endif -runManageHook :: ManageHook -> Window -> X (WindowSet -> WindowSet) -runManageHook (Query m) w = appEndo <$> runReaderT m w +runQuery :: Query a -> Window -> X a +runQuery (Query m) w = runReaderT m w instance Monoid a => Monoid (Query a) where mempty = return mempty diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs index faa5ad2..0e96893 100644 --- a/XMonad/Operations.hs +++ b/XMonad/Operations.hs @@ -23,6 +23,7 @@ import XMonad.Layout (Full(..)) import qualified XMonad.StackSet as W import Data.Maybe +import Data.Monoid (appEndo) import Data.List (nub, (\\), find) import Data.Bits ((.|.), (.&.), complement) import Data.Ratio @@ -65,7 +66,7 @@ manage w = whenX (not <$> isClient w) $ withDisplay $ \d -> do where i = fromMaybe (W.tag . W.workspace . W.current $ ws) $ W.lookupWorkspace sc ws mh <- asks (manageHook . config) - g <- runManageHook mh w `catchX` return id + g <- fmap appEndo (runQuery mh w) `catchX` return id windows (g . f) -- | unmanage. A window no longer exists, remove it from the window -- cgit v1.2.3