diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2008-02-23 14:07:02 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2008-02-23 14:07:02 +0100 |
commit | 41ba2da59ddd075ccf9b60fd19985a48713506ae (patch) | |
tree | b6e79e9f72637146917b3287286c28a327bd0c9b /XMonad/Core.hs | |
parent | 27371f845de92481e84f792e68c933e83865cd74 (diff) | |
download | xmonad-41ba2da59ddd075ccf9b60fd19985a48713506ae.tar.gz xmonad-41ba2da59ddd075ccf9b60fd19985a48713506ae.tar.xz xmonad-41ba2da59ddd075ccf9b60fd19985a48713506ae.zip |
add sendMessageWithNoRefresh and have broadcastMessage use it
This patch:
- moves broadcastMessage and restart from Core to Operations (to avoid
circular imports);
- in Operations introduces sendMessageWithNoRefresh and move
updateLayout outside windows.
- broadcastMessage now uses sendMessageWithNoRefresh to obey to this
rules:
1. if handleMessage returns Nothing no action is taken;
2. if handleMessage returns a Just ml *only* the layout field of the
workspace record will be updated.
darcs-hash:20080223130702-32816-60d71cd8ac32cff1d4039947142332023274a725.gz
Diffstat (limited to 'XMonad/Core.hs')
-rw-r--r-- | XMonad/Core.hs | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/XMonad/Core.hs b/XMonad/Core.hs index 1603034..ecbca29 100644 --- a/XMonad/Core.hs +++ b/XMonad/Core.hs @@ -25,8 +25,8 @@ module XMonad.Core ( Layout(..), readsLayout, Typeable, Message, SomeMessage(..), fromMessage, LayoutMessages(..), runX, catchX, userCode, io, catchIO, doubleFork, - withDisplay, withWindowSet, isRoot, runOnWorkspaces, broadcastMessage, - getAtom, spawn, restart, getXMonadDir, recompile, trace, whenJust, whenX, + withDisplay, withWindowSet, isRoot, runOnWorkspaces, + getAtom, spawn, getXMonadDir, recompile, trace, whenJust, whenX, atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runQuery ) where @@ -353,13 +353,6 @@ doubleFork m = io $ do getProcessStatus True False pid return () --- | Send a message to all visible layouts, without necessarily refreshing. --- This is how we implement the hooks, such as UnDoLayout. -broadcastMessage :: Message a => a -> X () -broadcastMessage a = runOnWorkspaces $ \w -> do - ml' <- handleMessage (layout w) (SomeMessage a) `catchX` return Nothing - return $ w { layout = maybe (layout w) id ml' } - -- | This is basically a map function, running a function in the X monad on -- each workspace with the output of that function being the modified workspace. runOnWorkspaces :: (WindowSpace -> X WindowSpace) -> X () @@ -370,18 +363,6 @@ runOnWorkspaces job = do $ current ws : visible ws modify $ \s -> s { windowset = ws { current = c, visible = v, hidden = h } } --- | @restart name resume@. Attempt to restart xmonad by executing the program --- @name@. If @resume@ is 'True', restart with the current window state. --- When executing another window manager, @resume@ should be 'False'. --- -restart :: String -> Bool -> X () -restart prog resume = do - broadcastMessage ReleaseResources - io . flush =<< asks display - args <- if resume then gets (("--resume":) . return . showWs . windowset) else return [] - catchIO (executeFile prog True args Nothing) - where showWs = show . mapLayout show - -- | Return the path to @~\/.xmonad@. getXMonadDir :: MonadIO m => m String getXMonadDir = io $ getAppUserDataDirectory "xmonad" |