aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/UIStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/UIStore.js')
-rw-r--r--src/stores/UIStore.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/stores/UIStore.js b/src/stores/UIStore.js
index 6941cf086..f6e059bfb 100644
--- a/src/stores/UIStore.js
+++ b/src/stores/UIStore.js
@@ -5,14 +5,14 @@ import { theme } from '@meetfranz/theme';
5import { remote } from 'electron'; 5import { remote } from 'electron';
6 6
7import Store from './lib/Store'; 7import Store from './lib/Store';
8import { isMac } from '../environment'; 8import { isMac, isWindows } from '../environment';
9 9
10const { nativeTheme, systemPreferences } = remote; 10const { nativeTheme, systemPreferences } = remote;
11 11
12export default class UIStore extends Store { 12export default class UIStore extends Store {
13 @observable showServicesUpdatedInfoBar = false; 13 @observable showServicesUpdatedInfoBar = false;
14 14
15 @observable isOsDarkThemeActive = isMac 15 @observable isOsDarkThemeActive = (isMac || isWindows)
16 ? nativeTheme.shouldUseDarkColors 16 ? nativeTheme.shouldUseDarkColors
17 : false; 17 : false;
18 18
@@ -36,6 +36,13 @@ export default class UIStore extends Store {
36 }, 36 },
37 ); 37 );
38 } 38 }
39
40 if (isWindows) {
41 nativeTheme.on('updated', () => {
42 this.isOsDarkThemeActive = nativeTheme.shouldUseDarkColors;
43 this.actions.service.shareSettingsWithServiceProcess();
44 });
45 }
39 } 46 }
40 47
41 setup() { 48 setup() {
@@ -56,16 +63,16 @@ export default class UIStore extends Store {
56 } 63 }
57 64
58 @computed get isDarkThemeActive() { 65 @computed get isDarkThemeActive() {
59 const isMacWithAdaptableInDarkMode = isMac 66 const isMacOrWindowsWithAdaptableInDarkMode = (isMac || isWindows)
60 && this.stores.settings.all.app.adaptableDarkMode 67 && this.stores.settings.all.app.adaptableDarkMode
61 && this.isOsDarkThemeActive; 68 && this.isOsDarkThemeActive;
62 const isMacWithoutAdaptableInDarkMode = isMac 69 const isMacOrWindowsWithoutAdaptableInDarkMode = (isMac || isWindows)
63 && this.stores.settings.all.app.darkMode 70 && this.stores.settings.all.app.darkMode
64 && !this.stores.settings.all.app.adaptableDarkMode; 71 && !this.stores.settings.all.app.adaptableDarkMode;
65 const isNotMacInDarkMode = !isMac && this.stores.settings.all.app.darkMode; 72 const isMacOrWindowsNotInDarkMode = !(isMac || isWindows) && this.stores.settings.all.app.darkMode;
66 return !!(isMacWithAdaptableInDarkMode 73 return !!(isMacOrWindowsWithAdaptableInDarkMode
67 || isMacWithoutAdaptableInDarkMode 74 || isMacOrWindowsWithoutAdaptableInDarkMode
68 || isNotMacInDarkMode); 75 || isMacOrWindowsNotInDarkMode);
69 } 76 }
70 77
71 @computed get theme() { 78 @computed get theme() {