Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FinderSync check if extension is selected

I am developing a FinderSync extension and I have some issues in checking if the selection is selecting, or selecting/deselecting the extension.

Is there a way to programmatically check if a FinderSync extension is selected in System Preferences->Extensions?

Are there any API's to get notified when this selection changes?

Is there any API to select/deselect an extension, beside using the following?

system("pluginkit -e use -i com.mycompany.finderExt")

Note that I have already visited these pages:

How to enable FinderSync Extension in the System Preference in Cocoa - Objective C

OSX Finder Sync Extension

like image 474
ciprian Avatar asked Oct 05 '15 08:10

ciprian


2 Answers

pluginkit -m -A -i com.mycompany.finderExt

If the extension is enabled, the call will return

"+ com.mycompany.finderExt(1)"

If the extension is not enabled, the call will return

"- com.mycompany.finderExt(1)"

Notice the plus and minus signs, just parse the return to determine if the extension is enabled.

like image 76
Cale Avatar answered Oct 06 '22 00:10

Cale


macOS 10.14 Mojave adds two useful new methods for Extension management:

The application hosting a Finder Sync Extension can determine whether the user has enabled the extension, and can show the UI for managing extensions. When the application becomes active again, it can check whether the user has enabled the extension.

@available(OSX 10.14, *)
open class var isExtensionEnabled: Bool { get }

@available(OSX 10.14, *)
open class func showExtensionManagementInterface()
like image 44
pkamb Avatar answered Oct 06 '22 01:10

pkamb