How to automatically hide a Mac app when clicking elsewhere on the screen

auto-hiding-mac-apps

Maintaining a clean workstation is perhaps one of the best ways to help with productivity and clear-thinking. Not only does this apply to one’s desk or office, but for those of us who work with computers, it extends to the Dock, folders, and desktop. Keeping things clean and orderly in OS X is vital for getting things done efficiently, and this Mac tip helps do exactly that.

This is accomplished by running a Terminal command that will hide an app of choice (automated equivalent to ⌘H) when it loses focus – that is, when you click anywhere else on the screen. This is great for apps that you find yourself referencing often but that are in the way when not in use. The downside to this tip is that users are required to run the command for every app to which they want to apply this action, and specifying each app requires its unique bundle identifier, so this tutorial is slightly in-depth.

Step 1: Locate the bundle identifier of the app you wish to automatically hide.

This can be found by navigating to the app in your Applications folder, right-clicking on it and selecting Show Package Contents, and viewing the Info.plist file in the Contents folder. Look for the value belonging to CFBundleIdentifier, which, in the case of the Twitter for Mac app, is com.twitter.twitter-mac, and this is what you’ll use to craft your Terminal command.

Twitter-mac-app-info-plist

Step 2: Open Terminal. This can be done by searching for Terminal in Spotlight or by locating it in the Applications folder. Your version of Terminal may look different from mine, and that’s ok.

Spotlight-Terminal-Yosemite

Step 3: Enter the following command into Terminal after substituting com.twitter.twitter-mac for the bundle identifier of your choice and press return:

defaults write com.twitter.twitter-mac HideInBackground -bool true

terminal-command-auto-hide-apps

The app you specified should now automatically be hidden when it loses focus, meaning when you click somewhere else on the screen or when you use ⌘Tab to select a different app. Enjoy a cleaner desktop in which apps of your choice automatically go away when you don’t need them.

Reverting back: If you want to undo this action for a particular app, simply follow the above steps to enter the command in Terminal, but change true to false on the end of the command.

defaults write com.twitter.twitter-mac HideInBackground -bool false

If this isn’t exactly what you’re looking for, be sure to check out Jeff’s posts on how to quickly hide everything but your current app and the difference between hiding and minimizing apps in OS X.