[xmonad] Reset layout to default on last window close

Brandon Allbery allbery.b at gmail.com
Wed Feb 29 00:55:25 CET 2012


On Tue, Feb 28, 2012 at 18:45, Nathaniel Filardo <nwfilardo at gmail.com>wrote:

> On Tue, Feb 28, 2012 at 3:18 PM, Brandon Allbery <allbery.b at gmail.com>
> wrote:
> >[snip]
> >> handleEventHook DestroyWindowEvent {} =
> >>   n <- (length . index) `fmap` withWindowSet
> >>   guard (n == 1) $ sendMessage $ JumpToLayout "name of initial layout
> here"
> >>   return (All True)
>
> Unless I am terribly mistaken, won't that send a message to the focused
> workspace if it has one window on it, rather than the (I assume intended)
> workspace where the closing window was located?
>

True.  You'd have to do a bit more work to find the correct workspace if
that's not the case.  But there's a nasty stinger in that tail:  if you
send a message to a workspace that is not current, the message won't
actually be sent because workspace operations require access to the
display, which can only be granted if the workspace is current.  So if it's
not the current workspace, you lose anyway.  There's no way to make it work.

And no, you can't approach it from the other direction, either; a different
version of the same problem gets in the way.  :/

(I recently filed a bug about the design issue that causes this.  It won't
be easily fixed.)

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20120228/61bff8ab/attachment.htm>


More information about the xmonad mailing list