Set the application's dark mode to follow the app settings on macOS. (#10186)

This commit is contained in:
fireblue
2025-01-11 05:07:17 +08:00
committed by GitHub
parent 0a475daa9c
commit f9dadf0816
2 changed files with 28 additions and 2 deletions

View File

@@ -130,7 +130,10 @@ export default class ElectronModule {
})
})
config.changed$.subscribe(() => this.updateVibrancy())
config.changed$.subscribe(() => {
this.updateVibrancy()
this.updateDarkMode()
})
config.changed$.subscribe(() => this.updateWindowControlsColor())
@@ -173,6 +176,11 @@ export default class ElectronModule {
this.hostWindow.setOpacity(this.config.store.appearance.opacity)
}
private updateDarkMode () {
const colorSchemeMode = this.config.store.appearance.colorSchemeMode
this.electron.ipcRenderer.send('window-set-dark-mode', colorSchemeMode)
}
private updateWindowControlsColor () {
// if windows and not using native frame, WCO does not exist, return.
if (this.hostApp.platform === Platform.Windows && this.config.store.appearance.frame === 'native') {