The title pretty much says it all. I need to know the terminal commands for "Application Windows" and "Show Desktop" in Mountain Lion so I can make aliases on the dock with Automator. I don't like hot corners, mostly because there are only four corners on the screen and more OS functionality than that. Keyboard shortcuts are all well and good, I just want options.


You can execute "Mission Control" with specific arguments to trigger the behavior that you desire:

Mission Control:

/Applications/Mission\ Control.app/Contents/MacOS/Mission\ Control

Show Desktop:

/Applications/Mission\ Control.app/Contents/MacOS/Mission\ Control 1

Application Windows:

/Applications/Mission\ Control.app/Contents/MacOS/Mission\ Control 2

Alternately, you could use osascript to execute the key code that you have setup for "Application Windows" and "Show Desktop". In the example below, I have "Desktop" mapped to the F8 key, and "Application Windows" setup to use F9. The key codes for these F keys can be found in various places.

osascript -e "tell applications \"System Events\"" -e "key code 100" -e "end tell"

osascript -e "tell applications \"System Events\"" -e "key code 101" -e "end tell"
  • 1
    This would technically work, but there's a catch. Changing the keyboard shortcut would break the automator app.
    – user59565
    Oct 16 '13 at 5:40
  • 1
    You can use whichever keyboard shortcut you've got setup...You just need to substitute the codes that are provided in the example above with those of your own. The link in the answer above provides additional codes. Alternately - which keyboard shortcut are you using? Oct 16 '13 at 6:20
  • 1
    I mean that if I decide I want a different keyboard shortcut AFTER creating the automator app, I have to modify the workflow AS WELL. Considering my predilection for tinkering for the sake of tinkering, which means that I change keyboard shortcuts multiple times every week, this is actually a problem. I'm sorry, but this is not really a workable answer.
    – user59565
    Oct 16 '13 at 21:37
  • I've updated the answer with something that you may find to be more workable. Oct 16 '13 at 21:54
  • Absolutely perfect; this is precisely what I was looking for! :D Just curious, how did you find these in the first place?
    – user59565
    Oct 17 '13 at 1:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .