FinderSync checks if extension is selected

I am developing a FinderSync extension and I have some problems when checking a selection or selecting / deselecting.

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

Is there any API to get notified when this choice changes?

Is there any API to select / deselect, except that the following is used:

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

Please note that I have already visited these pages:

How to Enable FinderSync Extension in System Preference in Cocoa - Goal C

OSX Finder Sync Extension

+5
source share
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)"

Pay attention to the plus and minus signs, just analyze the return to determine if the extension is enabled.

+7
source

The FinderSync extension is an "application", for sure. but its package is called .appex. when you enable it in System Preferences, macOS will automatically download it (you can check the Activity app or ps -ef command)

So, you can easily check it with some code:

 runningApps = [[NSRunningApplication runningApplicationsWithBundleIdentifier:@"your.bundle.id"] retain]; if runningApps.count != 0{ //your extension was enabled } else{ //your extension was not enabled } 
0
source

Source: https://habr.com/ru/post/1232952/


All Articles