diff options
author | kytwb <kytwb@pm.me> | 2022-01-09 16:59:09 +0100 |
---|---|---|
committer | kytwb <kytwb@pm.me> | 2022-01-09 16:59:09 +0100 |
commit | 8436a38ab929c8ce13133faf8fda22a716fd5d95 (patch) | |
tree | 77bd2e2c592bbf4fdaa1e968ae8f721f4ccbfcb0 /src | |
parent | #1140 Fix tray icon color on latest macOS (diff) | |
download | ferdium-app-8436a38ab929c8ce13133faf8fda22a716fd5d95.tar.gz ferdium-app-8436a38ab929c8ce13133faf8fda22a716fd5d95.tar.zst ferdium-app-8436a38ab929c8ce13133faf8fda22a716fd5d95.zip |
#1675 Fix Adaptable Dark Mode
Diffstat (limited to 'src')
-rw-r--r-- | src/stores/UIStore.js | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/stores/UIStore.js b/src/stores/UIStore.js index 9c194aa91..091b9b8eb 100644 --- a/src/stores/UIStore.js +++ b/src/stores/UIStore.js | |||
@@ -1,9 +1,8 @@ | |||
1 | import { action, observable, computed, reaction } from 'mobx'; | 1 | import { action, observable, computed, reaction } from 'mobx'; |
2 | import { nativeTheme, systemPreferences } from '@electron/remote'; | 2 | import { nativeTheme } from '@electron/remote'; |
3 | 3 | ||
4 | import { theme, ThemeType } from '../themes'; | 4 | import { theme, ThemeType } from '../themes'; |
5 | import Store from './lib/Store'; | 5 | import Store from './lib/Store'; |
6 | import { isMac, isWindows } from '../environment'; | ||
7 | 6 | ||
8 | export default class UIStore extends Store { | 7 | export default class UIStore extends Store { |
9 | @observable showServicesUpdatedInfoBar = false; | 8 | @observable showServicesUpdatedInfoBar = false; |
@@ -20,23 +19,11 @@ export default class UIStore extends Store { | |||
20 | this._toggleServiceUpdatedInfoBar.bind(this), | 19 | this._toggleServiceUpdatedInfoBar.bind(this), |
21 | ); | 20 | ); |
22 | 21 | ||
23 | // Listen for theme change on MacOS | 22 | // Listen for theme change |
24 | if (isMac) { | 23 | nativeTheme.on('updated', () => { |
25 | systemPreferences.subscribeNotification( | 24 | this.isOsDarkThemeActive = nativeTheme.shouldUseDarkColors; |
26 | 'AppleInterfaceThemeChangedNotification', | 25 | this.actions.service.shareSettingsWithServiceProcess(); |
27 | () => { | 26 | }); |
28 | this.isOsDarkThemeActive = nativeTheme.shouldUseDarkColors; | ||
29 | this.actions.service.shareSettingsWithServiceProcess(); | ||
30 | }, | ||
31 | ); | ||
32 | } | ||
33 | |||
34 | if (isWindows) { | ||
35 | nativeTheme.on('updated', () => { | ||
36 | this.isOsDarkThemeActive = nativeTheme.shouldUseDarkColors; | ||
37 | this.actions.service.shareSettingsWithServiceProcess(); | ||
38 | }); | ||
39 | } | ||
40 | } | 27 | } |
41 | 28 | ||
42 | setup() { | 29 | setup() { |