aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
authorLibravatar kytwb <kytwb@pm.me>2022-01-09 16:59:09 +0100
committerLibravatar kytwb <kytwb@pm.me>2022-01-09 16:59:09 +0100
commit8436a38ab929c8ce13133faf8fda22a716fd5d95 (patch)
tree77bd2e2c592bbf4fdaa1e968ae8f721f4ccbfcb0 /src/stores
parent#1140 Fix tray icon color on latest macOS (diff)
downloadferdium-app-8436a38ab929c8ce13133faf8fda22a716fd5d95.tar.gz
ferdium-app-8436a38ab929c8ce13133faf8fda22a716fd5d95.tar.zst
ferdium-app-8436a38ab929c8ce13133faf8fda22a716fd5d95.zip
#1675 Fix Adaptable Dark Mode
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/UIStore.js25
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 @@
1import { action, observable, computed, reaction } from 'mobx'; 1import { action, observable, computed, reaction } from 'mobx';
2import { nativeTheme, systemPreferences } from '@electron/remote'; 2import { nativeTheme } from '@electron/remote';
3 3
4import { theme, ThemeType } from '../themes'; 4import { theme, ThemeType } from '../themes';
5import Store from './lib/Store'; 5import Store from './lib/Store';
6import { isMac, isWindows } from '../environment';
7 6
8export default class UIStore extends Store { 7export 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() {