(Sorry in advance for the SEO-keyword heavy blog post. I want to make sure Google can do its job.)
@tylerhall Do you use libraries for the hotkey-setting UI or the start-on-launch stuff? I'm putting together my first Mac app and am looking into those parts rn.
I do, actually. In addition to replying to MacRae on the nightmare birdsite, I thought I'd post the two helper projects here for anyone else searching.
(It saddens me that so many of the Mac development resources I used to learn from and rely on have disappeared from Google (and Apple's developer website) since Mobile swallowed the industry. Ah, well. Here's my contribution...)
Creating Custom Global Keyboard Shortcuts in your macOS App
I've used the excellent MASSShortcut framework for years to handle global hotkeys in my Mac apps. Here's the original blog post about the project from Vadim Shpakovski. (By the way, this new app from Vadim looks super helpful.)
When I rebuilt my app CommandQ, I needed a way to trap
keyUp events in addition to the
keyDown events that MASShortcut offered. I modified the framework to allow that, and I'm sorry to say I'm a terrible open-source citizen and never contributed that patch back to the original project. But you can find my fork here.
How to Create a macOS Login Item For Your Mac App
Here's a small sample Xcode project I extracted from my existing apps. It shows how to create a helper app inside your main application to launch your app at login. (Hopefully, only if the user consents first!)
I'll be up-front and say I have no idea if this sample code is the "right way" to do this, if it ever was the right way, or if it's even the modern way any longer. I cribbed it together from a blog post years ago, and it's worked fine for me thus far.
If anyone would like to point out a better way, I'm all ears. And if anyone knows the original blog post author I should give credit to, I'd love to know that, too.