Skip to content

Instantly share code, notes, and snippets.

@konstantintuev
Created January 9, 2021 06:00
Show Gist options
  • Save konstantintuev/284f37448c071af28b463c13676a0fbd to your computer and use it in GitHub Desktop.
Save konstantintuev/284f37448c071af28b463c13676a0fbd to your computer and use it in GitHub Desktop.
A script to hide all mac login items because they choose to ignore the hide flag
global loginList
global loginListPath
on hideAllApps()
set counter to 0
repeat with name in loginList
set counter to counter + 1
set pathLocal to (item counter of loginListPath) as string
set nameLocal to name as string
log pathLocal
if nameLocal is not equal to "HideAllWindows" and nameLocal is not equal to "WindowsXPSound" then
repeat until application pathLocal is running
delay 1
end repeat
#tell application pathLocal to activate
tell application "Finder"
set visible of process nameLocal to false
end tell
end if
end repeat
end hideAllApps
on run {input, parameters}
log "ok"
tell application "System Events"
set loginList to get the name of every login item
set loginListPath to get the path of every login item
end tell
log "ok"
hideAllApps()
# teams and discord workaround below
set x to 0
repeat until x is 15
set x to x + 1
delay 1
hideAllApps()
end repeat
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment