A 'Show Desktop' applet wasn't included in Ubuntu Natty. However, there may be one present in Ubuntu Oneiric by default. Still, you can create a custom one for Natty as well.
1 . Firstly, we need to install a control program for window management:
2 . Create a script for 'wmctrl':
3 . Paste this code into the newly created file:
Save and close the file.
4 . Make the file executable:
5 . Create a .desktop file for the new applet, copy & paste the content all at once:
6 . Open your /home directory. Press Ctrl + H to see the hidden files and navigate to .local/share/applications. Drag and drop the "showdesktop.desktop" file you see there to the Unity Launcher and you are done.
When you click the icon, it starts blinking and might not respond to clicks for the next 10 sec or so unless the blinking stops. In that duration, you can use middle-click and force it to respond immediately.
sudo apt-get install wmctrl
gksudo gedit /usr/local/bin/showdesktop
#!/bin/sh
if wmctrl -m | grep "mode: ON"; then
exec wmctrl -k off
else
exec wmctrl -k on
fi
if wmctrl -m | grep "mode: ON"; then
exec wmctrl -k off
else
exec wmctrl -k on
fi
Save and close the file.
sudo chmod +x /usr/local/bin/showdesktop
echo "[Desktop Entry]
Name=Show Desktop
Exec=/usr/local/bin/showdesktop
Icon=desktop
Terminal=false
Type=Application
StartupNotify=false" | sudo tee ~/.local/share/applications/showdesktop.desktop
Name=Show Desktop
Exec=/usr/local/bin/showdesktop
Icon=desktop
Terminal=false
Type=Application
StartupNotify=false" | sudo tee ~/.local/share/applications/showdesktop.desktop
When you click the icon, it starts blinking and might not respond to clicks for the next 10 sec or so unless the blinking stops. In that duration, you can use middle-click and force it to respond immediately.