Add a Show Desktop icon to the Dock

The missing Show Desktop icon for the Dock!

Wouldn’t it be nice to activate Exposé’s Show Desktop mode via an icon on the Dock? Here’s how to make one that does just that. However, be warned: this works only one way — it shows the Desktop, but on clicking again, it does not bring the windows back. To get out of Exposé’s Show Desktop mode, just click anywhere along the darkened screen border.

1. Create an AppleScript application. Open AppleScript Editor (Applications » Utilities » AppleScript Editor in 10.6) and paste in this code:

(* Show Desktop AppleScript by Mohan Noone, 2009 *)
activate application "Finder"
do shell script "/Applications/Utilities/Expose.app/Contents/MacOS/Expose 1"

2. Save the script, name it something like Show Desktop, set the File Format to Application, and select the Run Only option in the Save dialog.
3. Optional: change the boring script icon. Select the saved file in Finder and hit Command-I to open the Get Info Window, then do the same for the file with the icon you’d like to use. Then select the better icon from its Get Info Window, copy it (Command-C), select the script icon in the other Get Info window, and paste (Command-V).
4. Drag the saved file to the Dock.

Your Show Desktop icon is ready for use!

This has been made to a downloadable app by geekyschmidt (thanks!). Grab it here.

Notes:

  • This works in 10.5 and 10.6, at least. For use in 10.5, you’ll need to take /Utilities out of the do shell script line.
  • While testing the icon, I found that it does not always work, unless finder is activated first. I have no idea why!
  • Note that you can activate Exposé’s other modes in this manner — change 1 to 2 and you’ll get Exposé’s Application Windows mode, and 3 gets you All Windows mode.

This hint is featured on macosxhints.com.