Last active
August 23, 2023 22:05
-
-
Save Teraflopst/e1863cfff5f0deb46ec2cabe9984305b to your computer and use it in GitHub Desktop.
AppleScript: Hide all applications and show the desktop on Mac
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 "Finder" | |
set visible of every process whose visible is true and name is not "Finder" to false | |
set the collapsed of windows to true | |
end tell |
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
set appName to "Mail" | |
set startIt to false | |
tell application "System Events" | |
if not (exists process appName) then | |
set startIt to true | |
else if frontmost of process appName then | |
set visible of process appName to false | |
else | |
set frontmost of process appName to true | |
end if | |
end tell | |
if startIt then | |
tell application appName to activate | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Beautiful! Works perfect as an Automator Login Item which hides every stubborn app which refuses to start hidden.