diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2008-01-24 02:32:07 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2008-01-24 02:32:07 +0100 |
commit | 2fc212c92a6b4d51c12520109d24f7d69a64d2d3 (patch) | |
tree | 77cee20c45d158eb9ef1eeb83848eb22b5f47973 /XMonad/Core.hs | |
parent | 52ba5826e93aabab0adaeb62ee33cc1d581c5d2a (diff) | |
download | xmonad-2fc212c92a6b4d51c12520109d24f7d69a64d2d3.tar.gz xmonad-2fc212c92a6b4d51c12520109d24f7d69a64d2d3.tar.xz xmonad-2fc212c92a6b4d51c12520109d24f7d69a64d2d3.zip |
Add emptyLayout to LayoutClass, a method to be called when a workspace is empty
darcs-hash:20080124013207-32816-35328360400d6ee06c81586b9e1cc45413df5a61.gz
Diffstat (limited to 'XMonad/Core.hs')
-rw-r--r-- | XMonad/Core.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/XMonad/Core.hs b/XMonad/Core.hs index 877a73a..df9c4b7 100644 --- a/XMonad/Core.hs +++ b/XMonad/Core.hs @@ -218,6 +218,10 @@ class Show (layout a) => LayoutClass layout a where pureLayout :: layout a -> Rectangle -> Stack a -> [(a, Rectangle)] pureLayout _ r s = [(focus s, r)] + -- | 'emptyLayout' is called when there is no window. + emptyLayout :: layout a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a)) + emptyLayout _ _ = return ([], Nothing) + -- | 'handleMessage' performs message handling for that layout. If -- 'handleMessage' returns Nothing, then the layout did not respond to -- that message and the screen is not refreshed. Otherwise, 'handleMessage' @@ -238,6 +242,7 @@ class Show (layout a) => LayoutClass layout a where instance LayoutClass Layout Window where doLayout (Layout l) r s = fmap (fmap Layout) `fmap` doLayout l r s + emptyLayout (Layout l) r = fmap (fmap Layout) `fmap` emptyLayout l r handleMessage (Layout l) = fmap (fmap Layout) . handleMessage l description (Layout l) = description l @@ -245,7 +250,7 @@ instance Show (Layout a) where show (Layout l) = show l -- | This calls doLayout if there are any windows to be laid out. runLayout :: LayoutClass l a => l a -> Rectangle -> Maybe (Stack a) -> X ([(a, Rectangle)], Maybe (l a)) -runLayout l r = maybe (return ([], Nothing)) (doLayout l r) +runLayout l r = maybe (emptyLayout l r) (doLayout l r) -- | Based on ideas in /An Extensible Dynamically-Typed Hierarchy of Exceptions/, -- Simon Marlow, 2006. Use extensible messages to the handleMessage handler. |