Post

Replies

Boosts

Views

Activity

Reply to How to obtain an app icon regardless of current icon style?
It's not identical to the way you'd get it from IconServices, but you can always try from the filesystem instead: let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "MY.APP.BUNDLE")! let img = (try? url.resourceValues(forKeys: [.effectiveIconKey]).effectiveIcon) as? NSImage img?.representations //This is full, but tinted let bnd = Bundle(url: url)! let name = bnd.infoDictionary?["CFBundleIconFile"] as? String ?? bnd.infoDictionary?["CFBundleIconName"] as? String ?? "" let img2 = bnd.image(forResource: name) img2?.representations //This is smaller but original
Topic: AppKit SubTopic:
AppKit Q&A
Jun ’26
Reply to Are NSStatusItem Interactions Still Allowed?
I was using NSStatusBarButton before, but now no events seem to be passed at all, which was why I tried the local event monitor as a last resort. It seems like interaction is now strictly scoped to a single left-click to expanded interface session, and that's it.
Topic: AppKit SubTopic:
AppKit Q&A
Tags:
Jun ’26
Reply to Per-Document Locale
Yes, I was wondering if there were any tips or pitfalls when the localization won't be applied by the frameworks themselves, and if the results can't be examined using the UI tools.
Topic: Localization SubTopic:
Localization Q&A
Jun ’26
Reply to Per-Document Locale
In this case the UI has very little contribution, because the localization is of/for the document's "output", so what is shown onscreen will be e.g. a PDF in PDFView. We're still looking to use Apple's localization tools throughout, but the context isn't the user's session, or the whole app, it's each document. The app will ship with the same lproj, etc, but they will be used explicitly in our code as abstracted in the Localization object.
Topic: Localization SubTopic:
Localization Q&A
Jun ’26
Reply to XPC Service Installed Outside App Doesn't Set Responsible
Sorry I didn't respond to this more quickly, I signed up for notifications (watch), but never got one. I'm using the terminology from an older document (at Daemons and Services Programming Guide) which says: Note: For communicating with XPC services outside your app bundle, you can also configure an XPC connection with the initWithMachServiceName: method. For details, see the documentation for that method. To my thinking, if the bundle is a completely valid XPC bundle (extension, structure, Info.plist keys, usage, etc), then it should be validate-able as XPC when determining the Responsible process. I'm also not completely out in left field, because this was advice I got from a Security engineer at WWDC this year, as we're trying to move this service from being required and PKG-installed (admin permissions) to optional and user-installable without escalation. I was advised to set it up as XPC (IPC was different before), place it outside the app bundle, set Launch Constraints, and XPC peer constraints to ensure a similar level of security, since the bundle's contents will technically be user-modifiable.
Oct ’25
Reply to NWProtocolFramer willMarkReady Can't Read After First Write?
The input is parsed into items, which were intended to be delivered "no copy" with a framer message attached. Even if the input is consumed and its contents put in the framer message, delivering zero-length input causes a stall. I was hoping the framer message might be ignored by protocols "above" the framer and passed to the connection "owner". The key is I was hoping to pass that (processed) input back (at least after markReady()) instead of discarding it. Is it possible for a framer to deliver messages after ready and pass through? Is there another mechanism for making that information available immediately in some kind of queue form?
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’22
Reply to How to obtain an app icon regardless of current icon style?
It's not identical to the way you'd get it from IconServices, but you can always try from the filesystem instead: let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "MY.APP.BUNDLE")! let img = (try? url.resourceValues(forKeys: [.effectiveIconKey]).effectiveIcon) as? NSImage img?.representations //This is full, but tinted let bnd = Bundle(url: url)! let name = bnd.infoDictionary?["CFBundleIconFile"] as? String ?? bnd.infoDictionary?["CFBundleIconName"] as? String ?? "" let img2 = bnd.image(forResource: name) img2?.representations //This is smaller but original
Topic: AppKit SubTopic:
AppKit Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to Best practice for activating a menubar app
I filed something similar in 2023 FB12399363
Topic: AppKit SubTopic:
AppKit Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to Are NSStatusItem Interactions Still Allowed?
See these: FB23018381 FB22983198
Topic: AppKit SubTopic:
AppKit Q&A
Tags:
Replies
Boosts
Views
Activity
Jun ’26
Reply to How to obtain an app icon regardless of current icon style?
Have you tried inspecting the representations of the NSImage? Or using another API, like NSURL EffectiveIcon?
Topic: AppKit SubTopic:
AppKit Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to AppKit NSAttributedString Document Types
Thank you for clarifying. The Markdown/HTML question was strictly Markdown to NSAttributedString to HTML.
Topic: AppKit SubTopic:
AppKit Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to Are NSStatusItem Interactions Still Allowed?
I was using NSStatusBarButton before, but now no events seem to be passed at all, which was why I tried the local event monitor as a last resort. It seems like interaction is now strictly scoped to a single left-click to expanded interface session, and that's it.
Topic: AppKit SubTopic:
AppKit Q&A
Tags:
Replies
Boosts
Views
Activity
Jun ’26
Reply to Best practice for activating a menubar app
Great question, especially since the window orderFront should be directly trackable by AppKit events and actions!
Topic: AppKit SubTopic:
AppKit Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to Are NSStatusItem Interactions Still Allowed?
For right-clicking I tried gesture recognizer, a button subclass with -rightMouseDown:, and also a local event monitor to see if I could find anything.
Topic: AppKit SubTopic:
AppKit Q&A
Tags:
Replies
Boosts
Views
Activity
Jun ’26
Reply to Per-Document Locale
Yes, I was wondering if there were any tips or pitfalls when the localization won't be applied by the frameworks themselves, and if the results can't be examined using the UI tools.
Topic: Localization SubTopic:
Localization Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to Documentation for ValidatedFormat/ValidFormatSpecifiers
So the specifiers must be provided in-order? The locale then is just used for numeric types. Is providing fewer specifiers still considered safe if they match the given order?
Topic: Localization SubTopic:
Localization Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to Per-Document Locale
In this case the UI has very little contribution, because the localization is of/for the document's "output", so what is shown onscreen will be e.g. a PDF in PDFView. We're still looking to use Apple's localization tools throughout, but the context isn't the user's session, or the whole app, it's each document. The app will ship with the same lproj, etc, but they will be used explicitly in our code as abstracted in the Localization object.
Topic: Localization SubTopic:
Localization Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to Documentation for ValidatedFormat/ValidFormatSpecifiers
FB23038053
Topic: Localization SubTopic:
Localization Q&A
Replies
Boosts
Views
Activity
Jun ’26
Reply to XPC Service Installed Outside App Doesn't Set Responsible
Sorry I didn't respond to this more quickly, I signed up for notifications (watch), but never got one. I'm using the terminology from an older document (at Daemons and Services Programming Guide) which says: Note: For communicating with XPC services outside your app bundle, you can also configure an XPC connection with the initWithMachServiceName: method. For details, see the documentation for that method. To my thinking, if the bundle is a completely valid XPC bundle (extension, structure, Info.plist keys, usage, etc), then it should be validate-able as XPC when determining the Responsible process. I'm also not completely out in left field, because this was advice I got from a Security engineer at WWDC this year, as we're trying to move this service from being required and PKG-installed (admin permissions) to optional and user-installable without escalation. I was advised to set it up as XPC (IPC was different before), place it outside the app bundle, set Launch Constraints, and XPC peer constraints to ensure a similar level of security, since the bundle's contents will technically be user-modifiable.
Replies
Boosts
Views
Activity
Oct ’25
Reply to Correct Way to Check If SecKey Requires User Interaction?
I did try kSecUseNoAuthenticationUI with kCFBooleanTrue and it has the same issue with SecItemCopyMatching. My own temporary test is to set user interaction to false and attempt to sign some random data. The query succeeds and returns a SecKey, which then fails the signature test.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to NWProtocolFramer willMarkReady Can't Read After First Write?
The input is parsed into items, which were intended to be delivered "no copy" with a framer message attached. Even if the input is consumed and its contents put in the framer message, delivering zero-length input causes a stall. I was hoping the framer message might be ignored by protocols "above" the framer and passed to the connection "owner". The key is I was hoping to pass that (processed) input back (at least after markReady()) instead of discarding it. Is it possible for a framer to deliver messages after ready and pass through? Is there another mechanism for making that information available immediately in some kind of queue form?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’22