Posts

Post not yet marked as solved
2 Replies
994 Views
Is there a SwiftUI idiomatic way to selectively remove the defualt (File, Edit, View, Window) menus from the menu bar in a macOS app, while keeping other menus like the AppName menu intact? The app I’m building is a simple utility app, and Edit and View menus are not relevant in this context. Any guidance would be appreciated.
Posted
by rakic.
Last updated
.
Post marked as solved
2 Replies
721 Views
It’s quite easy to detect if Mac has an illuminated keyboard with ioreg at the command line… ioreg -c IOResources -d 3 | grep '"KeyboardBacklight" =' | sed 's/^.*= //g' …But how can I programmatically get this IOKit boolean property using the latest Swift? I’m looking for some sample code.
Posted
by rakic.
Last updated
.
Post marked as solved
4 Replies
1.1k Views
We have a simple sandboxed app with important checkbox, and toggling it enables a system-wide setting. In order for this setting to be applied at login, we use a Service Management login item installed via SMLoginItemSetEnabled, located in in the main app bundle’s Contents/Library/LoginItems folder. A couple of questions: General — does the helper tool need to launch the main app, or can it apply the setting itself? All we have to do is apply a setting at login without showing UI, then terminate the app. Technical — does the helper tool need to be a full application bundle, or can it be just a simple sandboxed command line tool, since it has no UI? Any suggestions are welcome on how to elegantly solve this and still fly in Mac App Store.
Posted
by rakic.
Last updated
.
Post marked as solved
1 Replies
1.2k Views
After an extensive research, I haven’t found a canonical answer to what seems a fairly common task — placing a launch agent to the LaunchAgents folder. I would like to copy a propriety list file to ~/Library/LaunchAgents/com.mycompany.MyAgent.plist from my sandboxed app. Can this be achieved with app sandbox enabled? Which entitlement should I use (if any)? Will it pass the Mac App Store app review if I enable it? Is there a best practice that I’m missing? I know we’re not supposed to access a path outside of the app sandbox without the user’s consent, but I have a justified and legitimate case to copy a file with a particular com.mycompany.MyAgent.plist name to a very specific folder. ——— Note: I don’t need to manually start the launch agent. macOS will see my .plist file and load it automatically the next time it restarts. (Launch agents are regular user processes so none of this requires any special privileges.) Of course, if I try to copy the .plist file, it’s placed in a folder relative to my app’s container rather than the user’s real home folder. If I disable the sandbox, I get the desired result. Any help is greatly appreciated and good ideas are welcome. Thank you.
Posted
by rakic.
Last updated
.