Created
March 21, 2014 04:18
-
-
Save lgw4/9679432 to your computer and use it in GitHub Desktop.
A Better Finder Hide Command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
set frontProcess to first process whose frontmost is true | |
-- When it's down to just Finder and the front process, we have to switch | |
-- to the Finder first to get the front process to hide itself. Furthermore, | |
-- the Finder will not be listed as among the visible processes unless it | |
-- has open windows, so treat a condition of 2 *or fewer* visible apps as | |
-- meaning the Finder should be activated before hiding the front process. | |
if (count of (processes whose visible is true)) is less than or equal to 2 then | |
tell application "Finder" to activate | |
end if | |
set visible of frontProcess to false | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment