Some apps like Telegram or Slack starts wide open even with set in "Hide mode" on Mac login
There are some script or config to force an app to launch in hide mode ?
With Applescript I already try:
tell application "Mail" to launch
tell application "System Events" to set visible of process "Mail" to false
But is not what I search
2
Answers
In vanilla AppleScript, the
launch
command is supposed to launch an app in the background, but not hidden. Some apps use panels for their interfaces (rather than normal windows) and panels tend to pop up to the head of the window hierarchy, solaunch
doesn’t really help. I could muck around trying to find a pure AppleScript solution to this, but in this case it’s straightforward to invoke objective-C (requires Leopard or above).To run this at login, you’ll either want to turn it into an AppleScript application that you can put in the Login Items, or write a launchd agent that runs the script at login. See this question’s answers.
I’ve tested this on Telegram, but not Slack…
For those not already importing Objective-C frameworks, then you’ll want to avoid the overhead of doing so by sticking to vanilla AppleScript, for which one can simply use the
run
command for a silent launch: