-
Notifications
You must be signed in to change notification settings - Fork 16.5k
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.
Problem Description
Apps on macOS often use the vibrancy effect. Electron allows us to enable the effect on BrowserWindow
via the options and setVibrancy
. Users can disable this effect globally via the Accessibility Preferences (reduce transparency). When this preference is active, the respective Electron APIs to enable vibrancy will have no effect, which is good, but in order to style an app properly, following Apple's HID guidelines, it is often required to know whether or not this effect is enabled. I don't think it's currently possible to tell if that's the case, using the Electron API.
We have access to NSUserDefaults
via systemPreferences.getUserDefault()
but I believe it only offers access to the 'Apple Global Domain'. Additionally, some accessibility preferences can be queried via the nativeTheme
module.
Proposed Solution
Add nativeTheme.shouldReduceTransparency()
analogously to nativeTheme.shouldUseInvertedColorScheme()
.
Alternatives Considered
Alternatively, add a BrowserWindow.prototype.getVibrancy()
and return null if the effect is disabled (i.e., you could try to set a value via setVibrancy()
and then check if the effect was applied or not).
Another alternative would be to allow to arbitrarily query the 'com.apple.universalaccess' domain or allow to pass a domain to systemPreferences.getUserDefault()
.
Additional Information
Current workaround would be to spawn a process and call defaults read com.apple.universalaccess reduceTransparency
.