Add a Show Desktop icon to the Dock

Nov 19, '09 07:30:00AM

Contributed by: mlnoone

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!

[robg adds: 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. I'm also not sure why you need to activate the Finder first; it seems to work fine for me with just the shell script line. 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.]

Comments (15)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20091109075034143