I am using XMonad in a Gnome environment. How do I define a shortcut to minimize all windows and show the desktop?
I would not recommend it, because it is not 'the way' that XMonad should be used, but I do know two possible solutions to achieve what you want.
The way that I would do that is not to hide everything in your workspace but rather to just swap to a different workspace that is empty and there is a really handy Action in xmonad-contrib to do exactly that called FindEmptyWorpace. Essentially you just use it like this:
Even though I recommended the other way I will answer the question you asked. There are the hide and reveal functions that were meant for exactly this purpose. I have never used them before because I don't want to hide anything on my screens but the function definition is enough to explain that they are X Monad Actions that act on single windows so if you want to minimise them all then you will have to grab the current screen off the StackSet and then grab the workspace on that screen and then mapM hide onto every window in window stack of that workspace. For example in ghci:
So it could be done I just wouldn't be bothered when I could just goto a free window.
I realize that this is a very old post, but I recently found an elegant solution myself, and thought I would share it.
This solution is very nice in that it clears away all the windows, but also lets you return them to their previous state after you're done looking at the desktop.
It works by defining a new layout, and toggling to that layout on key press. A second key press will return you to whatever layout you were in.