When adding a custom plugin to a macOS package, how to make it follow the appearance setting of the operating System?

260 views Asked by At

After many years, I reopened this legacy Apple Sample Code that is an example of custom installer plugin. The project is so old that ships with a test package which is in the legacy (Bundle) format, and its resource file was a legacy .nib, that Xcode 12 could not open and edit. In the above repository, I have replaced this original nib with a copy obtained by opening the nib in Xcode 7 and resaving it. The plugin now works and its UI can be edited, but I am encountering a problem. Under any conditions, the package created with this installer plugin makes the entire package always display in light mode. My system is always in dark mode, but when the installer has a plugin, the entire package displays in light mode. I have tried:

  1. The sample (Bundle) test package is the simplest way to test: you can just open it with show package contents and create a hierarchy like explained in the readme file. The resulting package has the plugin correctly working, but displays always in light mode.

  2. I have tried to use modern tools, like packagebuild and productbuild, to embed the plugin in a flat package. The resulting package has the plugin correctly working, but displays always in light mode.

Any help is greatly appreciated. Thanks.

EDIT:

I have just tried to create a new installer plugin from scratch. Same behavior, only displays in light mode. Thanks

1

There are 1 answers

0
Alfonso Tesauro On BEST ANSWER

I opened a developer code level support ticket about this, and I was happy to receive the response, and it can be done ! Great. Here is the answer:

In response to your finding, the solution is to implement the “NSRequiresAquaSystemAppearance” plist key inside the Installer plugin bundle. Set this key to YES to enable the current Aqua setting and NO to disable Aqua matching.

At the beginning I did not well understand. The relevant key has to be added to the plugin bundle in the info.plist, and, it defaults to YES, that according to my understanding, means force light appearance. I have set it to NO, and the package with the plugin now correctly displays in dark when needed. Thanks for your attention.