Brett Terpstra on Toggling and Hiding Apps via AppleScript »

I always enjoy reading what other people are AppleScripting as it usually gives me some ideas about how to better use my Mac. I use LaunchBar as my application launcher, so Brett Terpstra’s script didn’t directly hit the sweet spot of fixing a problem I had, but it did get me thinking about what I do when I want to hide the current application.

I didn’t have any tricks, so shortly after reading the post, I wrote this dead simple AppleScript to hide the frontmost app:

tell application "System Events"
    set current_app to name of first process where frontmost is true
    set visible of process current_app to false
end tell

Just as I was about to assign this to a FastScripts keyboard shortcut, it occurred to me that I was probably over-thinking it and OS X had to already support this functionality in some way, right?

A Google search later confirmed it: Cmd-H hides the current app, and for bonus points, you have Cmd-Option-H which hides all apps except for the current app.

Two great keyboard shortcuts I was previously unaware of. Thanks, Brett. It all started with your post.


Leave a Reply