Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Electron Version
13.1.8
What operating system are you using?
macOS
Operating System Version
macOS Big Sur 11.4
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
No response
Expected Behavior
After attempting to reset the appLevelAppearance from either light
or dark
to using the operating system appearance does not work by setting it to unknown
. That gave me a "conversion error".
Taking a look into the source code for the systemPreferences
API, one can see that there are in fact three possible ways of setting the appLevelAppearance
– light, dark and one being undocumented – namely the null
value:
electron/shell/browser/api/electron_api_system_preferences_mac.mm
Lines 44 to 47 in 4703dc0
In fact, the appLevelAppearance
can successfully be reset by using the following line of code:
systemPreferences.appLevelAppearance = null
I tested this and it worked out of the box.
Actual Behavior
However, upon trying this and set the appLevelAppearance to null
, it turned out the Electron types (used for TypeScript) give me an error. But they do not give me an error using the wrong value of 'unknown'
which throws the above-mentioned "conversion error".
I recommend the following updates:
- Update the Electron typings so that the
appLevelAppearance
setter acceptsnull
as a valid property to set the app-level appearance tonil
- Update the documentation to reflect that you can reset the
appLevelAppearance
at runtime by setting it tonull
Further, I think it might be more appropriate to consolidate getter and setter and, instead of returning "unknown" return the JavaScript representation of nil
, namely: null
(or even undefined
). Alternatively, the setter might accept unknown
and convert that internally to nil
.
Testcase Gist URL
No response
Additional Information
No response