Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
For Brent...
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
You can’t perform that action at this time.