Right now I have to minimize all windows one by one to get to the desktop. Is there a way to directly view the desktop?
I personally like to use
Hot corners to show the desktop.
To do this, first install devilspie with:
sudo apt-get install devilspie
Then create a script file with:
(or some other text editor) and inside that file paste the following content:
(if (begin (not(is(application_name) "wingpanel"))) (if (begin (not(is(application_name) "plank"))) (begin (minimize) (quit)) ))
save and exit the text editor.
Preferences/Desktop/Hot corners, select
Personalized order for one of the corners and in the
Execute custom command text box paste the following:
<user> with your user name, so it looks like this (I've selected the bottom right corner):
After that, moving the mouse to that corner should show you the desktop.
I use devilspie like in Gabriel's answer, only I like to be able to restore my windows with the same script, so my devilspie script looks like:
(begin (if (matches (window_property "_NET_WM_STATE") "_NET_WM_STATE_HIDDEN") (begin (unminimize) (quit) ) (begin (minimize) (quit) ) ) (quit) )
Everything else is the same as Gabriel's answer.
The only problem is it does not keep my windows in the same order when it restores them.
Install Windows Management control or wmctrl:
sudo apt install wmctrl
now, typing the following command in the terminal will show the desktop:
wmctrl -k on
That is OK, but it is easier with a keyboard shortcut.
Open System Settings->Keyboard (or search keyboard in Applications for Loki 0.4 Elementary OS and possibly other distributions)
Go to 'Shortcuts tab
Go to 'Custom'
Click the '+' and type
wmctrl -k onand 'Enter'
The shortcut will show is 'Disabled' on the right
Try it: click you shortcut. You should see the desktop
That is it. You are done.
I have done a bash script which uses Xwindow utilities such as xwininfo, xdotool and wmctrl. All details and full Code of the script at http://fpkanarias.blogspot.com.es/2017/12/elementary-os-script-para-mostrar.html