We normally have a show desktop button in our Windows taskbar. This tutorial helps you add the same feature in your dash.
Option A - For Dash to Panel
Dash to Panel settings - enable Show Desktop
Option B - Other docks (Dash to Dock, Ubuntu Dock, etc.):
- Install wmctrl
- Create a script for Show Desktop
sudo touch /usr/local/bin/show-desktop
- Open it using a text editor
- Type and save:
#!/bin/bash status="$(wmctrl -m | grep "showing the desktop" | sed -r 's/(.*)(ON|OFF)/\2/g')" if [ $status == "ON" ]; then wmctrl -k off else wmctrl -k on fi
- Create a desktop file for Show Desktop
touch ~/.local/share/applications/show-desktop.desktop
- Open it using a text editor
- Type and save
[Desktop Entry] Type=Application Name=Show Desktop Icon=desktop Exec=show-desktop
- Add it to favorites to make it appear in the dock