Using NSDockTilePlugIn
Customizing an application’s Dock tile when the application itself is not running requires that you write a plug-in. The plug-in’s principal class must implement the
NSDockTilePlugIn
protocol.The name of the plugin is indicated by a
NSDockTilePlugIn
key in the application’s Info.plist file.The plugin is loaded in a system process at login time or when the application tile is added to the Dock. When the plugin is loaded, the principal class’ implementation of
setDockTile(_:)
is invoked, passing anNSDockTile
for the plug-in to customize. If the principal class implementsdockMenu()
it is invoked whenever the user causes the application’s dock menu to be shown.[…]
It is rare to see apps use
NSDockTilePlugIn
because apps that contain one are not allowed on the Mac App Store.
Previously:
5 Comments RSS · Twitter · Mastodon
That App Store restriction is a killer. It's why Nova uses a dock tile plugin but Transmit and Prompt do not.
Positively ancient API, and sad that Apple hasn't bothered building a proper, safe plugin API for dock tiles in nearing 25 years.
At first my reaction was, “do they want people to use the Mac App Store or not?” But after the comment above it makes more sense. It seems they’re instead using it to take the “easy” way out of security issues by just disallowing entire categories.
Still though, the system is capable of the things they disallow, so what really is the message they are sending? They don’t even seem to defend the Mac App Store as much as they do the iOS store. It’s not clear to me how Apple themselves sees the purpose of the MAS anymore.
I'm using such a Dock tile plugin in Find Any File, letting users change the icon betwen classic and squircle. Only works if you download the app from my website, but not when installed from the MAS. This is the first true difference between both versions (Indie vs MAS). I expect more of this in the future.
Oh, and to whomever attempts to write a Dock plugin: Make sure to change the default NSPrincipalClass in the Info.plist, because that is used as a key to tell plugins apart - I had accidentally left that unchanged, as did another app - and then our two plugins got confused by the Dock.