On Tue, Feb 28, 2012 at 10:44, Alexander Batischev <eual.jp@gmail.com> wrote:
I want workspace layout to reset to some default once last window is
closed. Quick glance though Xmonad-related modules names didn't give me
any hints on what hook (or some other facility) to use, so I'm seeking
your advice, fellow Xmonaders: how can I accomplish that?

Use XMonad.Layout.LayoutCombinators; you want its version of the (|||) operator so you can send the JumpToLayout message.

Beyond that, you want to use a handleEventHook which matches DestroyWindowEvent and checks the contents of the current workspace; if only one window is present, send the JumpToLayout message.  It should end up being something like this (untested):

> import XMonad hiding (|||)
> import XMonad.Layout.LayoutCombinators
> import qualified XMonad.StackSet as W
> import Data.Monoid -- for All
...
> handleEventHook DestroyWindowEvent {} =
>   n <- (length . index) `fmap` withWindowSet
>   guard (n == 1) $ sendMessage $ JumpToLayout "name of initial layout here"
>   return (All True)

--
brandon s allbery                                      allbery.b@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms