summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2007-06-12 07:53:39 +0200
committerStefan O'Rear <stefanor@cox.net>2007-06-12 07:53:39 +0200
commit78010c48aa164e9df28557e37555f3eaf99c7e87 (patch)
tree988705082a59876012984529e4868a75bd84747c /Operations.hs
parente0d7522a1b78f03346efa22b0e2c6dd997e1b030 (diff)
downloadmetatile-78010c48aa164e9df28557e37555f3eaf99c7e87.tar
metatile-78010c48aa164e9df28557e37555f3eaf99c7e87.zip
Add a broadcastMessage function, which sends to all visible workspaces without refreshing. (+6 loc)
darcs-hash:20070612055339-e3110-05285df631a523afce0a2c6dca993df9dfbad470
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs10
1 files changed, 10 insertions, 0 deletions
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
--