chore: deprecate systemPreferences.isAeroGlassEnabled()
(#45434)
This commit is contained in:
parent
14fe0932f0
commit
e055ce7c39
8 changed files with 30 additions and 43 deletions
|
@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process), [Utility](../glossary.md#utility-p
|
|||
|
||||
```js
|
||||
const { systemPreferences } = require('electron')
|
||||
console.log(systemPreferences.isAeroGlassEnabled())
|
||||
console.log(systemPreferences.getEffectiveAppearance())
|
||||
```
|
||||
|
||||
## Events
|
||||
|
@ -181,35 +181,13 @@ Some popular `key` and `type`s are:
|
|||
Removes the `key` in `NSUserDefaults`. This can be used to restore the default
|
||||
or global value of a `key` previously set with `setUserDefault`.
|
||||
|
||||
### `systemPreferences.isAeroGlassEnabled()` _Windows_
|
||||
### `systemPreferences.isAeroGlassEnabled()` _Windows_ _Deprecated_
|
||||
|
||||
Returns `boolean` - `true` if [DWM composition][dwm-composition] (Aero Glass) is
|
||||
enabled, and `false` otherwise.
|
||||
|
||||
An example of using it to determine if you should create a transparent window or
|
||||
not (transparent windows won't work correctly when DWM composition is disabled):
|
||||
|
||||
```js
|
||||
const { BrowserWindow, systemPreferences } = require('electron')
|
||||
const browserOptions = { width: 1000, height: 800 }
|
||||
|
||||
// Make the window transparent only if the platform supports it.
|
||||
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
|
||||
browserOptions.transparent = true
|
||||
browserOptions.frame = false
|
||||
}
|
||||
|
||||
// Create the window.
|
||||
const win = new BrowserWindow(browserOptions)
|
||||
|
||||
// Navigate.
|
||||
if (browserOptions.transparent) {
|
||||
win.loadFile('index.html')
|
||||
} else {
|
||||
// No transparency, so we load a fallback that uses basic styles.
|
||||
win.loadFile('fallback.html')
|
||||
}
|
||||
```
|
||||
**Deprecated:**
|
||||
This function has been always returning `true` since Electron 23, which only supports Windows 10+.
|
||||
|
||||
[dwm-composition]: https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw
|
||||
|
||||
|
|
|
@ -63,6 +63,13 @@ webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame
|
|||
|
||||
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
|
||||
|
||||
### Deprecated: `systemPreferences.isAeroGlassEnabled()`
|
||||
|
||||
The `systemPreferences.isAeroGlassEnabled()` function has been deprecated without replacement.
|
||||
It has been always returning `true` since Electron 23, which only supports Windows 10+, where DWM composition can no longer be disabled.
|
||||
|
||||
https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw#disabling-dwm-composition-windows7-and-earlier
|
||||
|
||||
## Planned Breaking API Changes (34.0)
|
||||
|
||||
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue