[xmonad] Hiding windows, showing desktop

Norbert Zeh nzeh at cs.dal.ca
Fri Feb 18 17:55:29 CET 2011


Norbert Zeh [2011.02.18 1110 -0400]:
> Hi folks,
> 
> I'm interested in temporarily hiding all the windows on one of my workspaces.
> Ideally, I'd also like to restore them to their original state either by
> pressing a key again or, even better, as soon as I'm doing something that
> affects the current layout (press focusUp key, for example).
> 
> So here are my questions:
> 
> (1)  Is this functionality available in XMonadContrib and I just didn't know
> how to look?  If so, pointers are appreciated.
> 
> (2)  If the answer to (1) is no, then I don't mind implementing it, but I'd
> appreciate pointers on how to go about it.  Here's what I tried so far.
> 
> Option 1:  In order to support the behaviour that a change of the current
> layout should restore the windows, I wrote a layout modifier.  It simply ran
> "hide" over the windows it gets in the stack passed to it and later restored
> them using "reveal".  This worked nicely, but it didn't hide floating windows.
> The reason, I thought: floating windows are not passed to the layout.
> 
> Option 2:  To overcome the problem with Option 1, I changed the code so that
> the messages to the layout modifier include the *entire* window list of the
> current workspace, not only the non-floating ones, and then I handled that
> list.  The result: nothing changed because, as it turns out, after the layout
> is done doing whatever it does, the "windows" function in the core XMonad
> applies "reveal" to all floating windows on the current workspace.
> 
> Option 3:  So I thought this calls for heavier guns.  So one thing I tried was
> to temporarily replace the window stack of the current workspace with Nothing
> and later bring it back.  My current code for this doesn't do the right thing
> and causes lots of trouble.  While some debugging and tweaking and hacking may
> get that to work eventually, it just seems too hackish an approach.
> 
> So, what do the xmonad gurus say about how one could implement this?  With
> things like conky running on one's desktop, this seems to be a rather useful
> functionality to have.

I think I have a semi-elegant solution myself.  Create a "hidden" workspace the
same way the Scratchpad modules do it.  Then shunt the entire stack over to
that workspace to hide the windows on the current workspace and do the reverse
to restore them.

This should be fairly easy to do.  If anybody has a more elegant solution, I'd
love to hear about it.

Thanks,
Norbert



More information about the xmonad mailing list