plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

Use SMAppService to register the app to LoginItems instead of an AppleScript

Open iparaskev opened this issue 7 months ago • 3 comments

At Hopp, we want our app to start automatically on user login. Initially, we used the autostart plugin, which does the job but we thought that user experience can be improved.

In particular we found the two notifications the user receives slightly annoying.

Image

Image

We didn't like them because

  • They are two instead of just one when using a native API.
  • It isn’t entirely clear from the pop-ups which app is being added to the login items.

To address these, I decided to make smappservice-rs, which is just a rust wrapper for macOS's ServiceManagement framework. When it is used instead of auto-launch it gives only one notification.

Would you consider accepting an enhancement to the autostart plugin that introduces a third option leveraging smappservice-rs?

I can also try extending auto-launch If you think that this change is more appropriate there. The reason I am first trying here is that auto-launch can be used to launch any app on start up, while smappservice-rs is for the running app only.

Note: I tested whether issue #2342 could be resolved using smappservice-rs, and it appears to work. Perhaps someone else could verify this as well.

iparaskev avatar May 26 '25 16:05 iparaskev

I wouldn't mind adding it to the plugin but isn't this something that should be upstreamed into auto-launch ?

FabianLars avatar May 26 '25 18:05 FabianLars

The problem I see with auto-launch is that it requires the app-name and app-path to not be None. When an app is registered via the SMAppService, setting the app-name and path doesn't make a lot of sense because the app is registering itself, for example see registering the mainAppService. I guess we could modify auto-launch to ignore these parameters when SMAppService is used.

I will create an MR for auto-launch (it won't take long) and let the maintainer decide.

I will come back here to report any updates.

iparaskev avatar May 26 '25 20:05 iparaskev

autolaunch seems to be sitting on this, would be good to get a patch at the very least

chad-fossa avatar Nov 18 '25 21:11 chad-fossa