From 78010c48aa164e9df28557e37555f3eaf99c7e87 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Tue, 12 Jun 2007 07:53:39 +0200 Subject: Add a broadcastMessage function, which sends to all visible workspaces without refreshing. (+6 loc) darcs-hash:20070612055339-e3110-05285df631a523afce0a2c6dca993df9dfbad470 --- Operations.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Operations.hs b/Operations.hs index d51b1e2..f5a78a3 100644 --- a/Operations.hs +++ b/Operations.hs @@ -36,6 +36,8 @@ import Graphics.X11.Xlib import Graphics.X11.Xinerama (getScreenInfo) import Graphics.X11.Xlib.Extras +import qualified Data.Traversable as T + -- --------------------------------------------------------------------- -- | -- Window manager operations @@ -350,6 +352,14 @@ sendMessage a = do n <- (W.tag . W.workspace . W.current) `fmap` gets windowset whenJust ml' $ \l' -> do modify $ \s -> s { layouts = M.insert n (l',ls) (layouts s) } refresh +-- | Send a message to all visible layouts, without necessarily refreshing. +-- This is how we implement the hooks, such as ModifyWindows. +broadcastMessage :: Message a => a -> X () +broadcastMessage a = do + ol <- gets layouts + nl <- T.forM ol $ \ (l,ls) -> maybe (l,ls) (flip (,) ls) `fmap` modifyLayout l (SomeMessage a) + modify $ \s -> s { layouts = nl } + instance Message Event -- -- cgit v1.2.3