Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OS Login Items with Arguments?

In Mac OS, I've created a few AppleScripts to add and remove start up applications (Login Items, under the Accounts system pane).

#!/bin/bash
/usr/bin/osascript -e "tell application \"System Events\" to make new login item with properties { path: \"$1\", hidden:false } at end"

Usage would be like this:

./addloginitem.sh /Applications/TextEdit.app

I'm curious if it's possible to have startup items that use arguments? I have a program that I would like to pass a "startup" argument to if it is running directly after a login.

like image 581
jocull Avatar asked Feb 06 '11 07:02

jocull


People also ask

How do I manage login items on Mac?

On your Mac, choose Apple menu > System Preferences, then click Users & Groups . Click your account name below Current User, then click Login Items at the top of the window. Make a list of the login items—you'll need to remember them later. Select all of the login items, then click the Remove button .

What does hide mean in login items Mac?

Hide a login item: If you don't want an item's windows to be visible after login, select the Hide checkbox next to the item.


1 Answers

It is possible however not by using "Login Items". You can use launchd to run commands when you login. It's a little complicated to use compared to login items but they're much more flexible and can do as you request. Just google for launchd instructions, setup the required plist file, and you'd have a powerful method for launching things at login.

like image 185
regulus6633 Avatar answered Sep 25 '22 22:09

regulus6633