Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add a Show Desktop icon to the Dock System
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.]
    •    
  • Currently 2.65 / 5
  You rated: 1 / 5 (23 votes cast)
 
[21,926 views]  

Add a Show Desktop icon to the Dock | 15 comments | Create New Account
Click here to return to the 'Add a Show Desktop icon to the Dock' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add a Show Desktop icon to the Dock
Authored by: ChaChi on Nov 19, '09 07:55:46AM
I would advise against EVER saving an AppleScript application as "Run Only"! That only prevents future editing of the script. If you want to protect your code, and will be distributing the script to several people, then select "Run Only". Otherwise, this option will only give you headaches in the long run when you realize you can't ever edit the script again after selecting that option. Something else you can do though is save the script as "Stay Open" and change the script like this:
on run
reopen
end run

on reopen
do shell script "/Applications/Utilities/Expose.app/Contents/MacOS/Expose 1"
end reopen
This one line script hardly needs to be saved as "Stay Open" though!

[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: chabig on Nov 19, '09 07:57:07AM

It's pointless to activate the Finder. Just run the shell script.



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: mlnoone on Nov 19, '09 05:14:57PM

While testing the icon, I found that it does not always work, unless finder is activated first. I have no idea why!

---
Mohan Noone



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: oneguynick on Nov 19, '09 08:13:42AM
Made a quick app with the GNOME Show Desktop icon: Show Desktop

[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: mlnoone on Nov 20, '09 07:59:09AM

That's cool!

---
Mohan Noone



[ Reply to This | # ]
Great, but now how do I close the descktop exposure
Authored by: SOX on Nov 19, '09 09:55:54AM

When I run this it shows my desktop as desired. But now how do I revert back from the exposed desktop?

Also one tweak to this. in the script editor save it as an application bundle then move the the icons from the expose package to this script renaming them to the default name applet.icns (delete the default icons in the resources bundle of the script). Now it will look like the expose app in the dock.



[ Reply to This | # ]
Great, but now how do I close the descktop exposure
Authored by: Mac Berry on Nov 19, '09 10:19:35AM

By the method mentioned in the hint ;)

Mark



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: Stormchild on Nov 19, '09 10:21:46AM

"Wouldn't it be nice to activate Exposé's Show Desktop mode via an icon on the Dock?"

…no, not really.



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: UberFu on Nov 19, '09 10:50:41AM

Wow - another Script that re-invents the wheel - great!



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: infodriveway on Nov 19, '09 02:47:17PM

Or, just add the Exposé icon to the Dock, then right click it, and choose “Show Desktop”. I know this is TWO clicks — but this may be enough for most people.

Also, on my system (a late 2008 MacBook Pro), it still takes a few seconds for an AppleScript app to run.

Since the Exposé.app talks directly to the Dock.app process, this takes about ONE second total.

---
There is nothing special about equal rights!



[ Reply to This | # ]
Multitouch gesture
Authored by: SeanAhern on Nov 19, '09 10:23:06PM

Four-finger swipe up.



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: Mac Berry on Nov 20, '09 09:08:48AM

I'll bet good money that I can get my mouse to the top right hot corner of my screen, AND then a second time, to show the desktop then bring the windows back, quicker than anyone can click on this icon, wait for the script to run, then click on the screen border.

I've argued against people criticizing hints just because they wouldn't use them themselves before now, but that applies to stuff that people may not spot otherwise. I'm pretty fed up with the number of "I know you can do it using the GUI, Terminal, the keyboard, gestures and goodness knows what else, but I know, write a script" type hints here lately.

Saying "write a script to do it" is NOT a hint. It's sharing a script you wrote! The only real hint is; keep scripting in mind when you want a better workflow, otherwise this won't stop until every single thing you can do on a Mac has a scripted method posted.

If Mac OSX Hints is to include these, then lets please have them in a separate "useful scripts" section.

Mark



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: ordnanceelf on Nov 20, '09 09:54:40AM

In the Exposé System Preferences Pane, you can set up "Desktop" to be activated via a "hot corner".

Once activated, it can then be de-activated by moving the mouse back to the same corner.



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: Mac Berry on Nov 20, '09 02:48:29PM

Yes, that's what I said ??



[ Reply to This | # ]
Add a Show Desktop icon to the Dock
Authored by: thewildman on Nov 20, '09 11:04:04PM

An alternative to this hint or using Expose hot corner is the sweet little mouse gesture app Expogesture http://ichiro.nnip.org/osx/Expogesture/index_en.html



[ Reply to This | # ]