<div dir="ltr">On Mon, Aug 27, 2012 at 5:48 AM, Jeffrey David Johnson <span dir="ltr">&lt;<a href="mailto:jefdaj@gmail.com" target="_blank">jefdaj@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;d like to have a different layout depending on how many windows are visible. Something like:<br>
<br>
one?            --&gt; Full<br>
under four? --&gt; Tall<br>
otherwise    --&gt; Grid<br></blockquote><div><br></div><div>Hm, this would be a simple generalization of a module I&#39;ve been working on that already distinguishes between 1 and multiple windows.  But it&#39;s waiting for me to get a test environment back up and running, which is taking a while :(</div>
<div><br></div><div>I&#39;ve attached the current version; it compiles but is not tested in practice.  It should be clear enough how to extend it to support other values than One and Multiple.</div><div><br></div><div>The problem with doing it in the ManageHook is that it can only see new windows being added, not windows being removed.  You would have to listen for UnmapWindow or DestroyWindow events in the handleEventHook to catch the latter; or do it in the layout, which listens for all of them for you.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I couldn&#39;t find an existing function, and didn&#39;t make much headway writing my own either. (I tried to use sendMessage $ JumpToLayout &quot;Full&quot; etc. in a managehook) Is there an obvious way to do this?<br>
</blockquote><div><br></div><div>In general this is (liftX ({- general code goes here -}) &gt;&gt; idHook).  The idHook is needed to switch the type back from Query () to Query (Endo WindowSet); a ManageHook really wants to operate on workspaces, not run random code, so we need to apply the dummy workspace update.  We may add a (doX) function at some point since the idiom seems to come up a lot.</div>
<div><br></div></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>