diff options
author | 2020-01-31 16:44:56 +0100 | |
---|---|---|
committer | 2020-01-31 16:44:56 +0100 | |
commit | 5714e2fbae7d8b6f69adc3ae064cded2bb8c35d7 (patch) | |
tree | 32fb9ff66f9bdbf01a0632a18de538574e8f63d6 | |
parent | Fix lint (diff) | |
download | ferdium-app-5714e2fbae7d8b6f69adc3ae064cded2bb8c35d7.tar.gz ferdium-app-5714e2fbae7d8b6f69adc3ae064cded2bb8c35d7.tar.zst ferdium-app-5714e2fbae7d8b6f69adc3ae064cded2bb8c35d7.zip |
Add better sync between Ferdi and service dark mode
-rw-r--r-- | src/actions/service.js | 1 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 6 | ||||
-rw-r--r-- | src/stores/UIStore.js | 1 | ||||
-rw-r--r-- | src/webview/recipe.js | 9 |
4 files changed, 14 insertions, 3 deletions
diff --git a/src/actions/service.js b/src/actions/service.js index 3283d8fee..d32bb80d3 100644 --- a/src/actions/service.js +++ b/src/actions/service.js | |||
@@ -98,4 +98,5 @@ export default { | |||
98 | serviceId: PropTypes.string.isRequired, | 98 | serviceId: PropTypes.string.isRequired, |
99 | hibernating: PropTypes.bool.isRequired, | 99 | hibernating: PropTypes.bool.isRequired, |
100 | }, | 100 | }, |
101 | shareSettingsWithServiceProcess: {}, | ||
101 | }; | 102 | }; |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 3dd601bc3..731305141 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -83,6 +83,7 @@ export default class ServicesStore extends Store { | |||
83 | this.actions.service.openDevTools.listen(this._openDevTools.bind(this)); | 83 | this.actions.service.openDevTools.listen(this._openDevTools.bind(this)); |
84 | this.actions.service.openDevToolsForActiveService.listen(this._openDevToolsForActiveService.bind(this)); | 84 | this.actions.service.openDevToolsForActiveService.listen(this._openDevToolsForActiveService.bind(this)); |
85 | this.actions.service.setHibernation.listen(this._setHibernation.bind(this)); | 85 | this.actions.service.setHibernation.listen(this._setHibernation.bind(this)); |
86 | this.actions.service.shareSettingsWithServiceProcess.listen(this._shareSettingsWithServiceProcess.bind(this)); | ||
86 | 87 | ||
87 | this.registerReactions([ | 88 | this.registerReactions([ |
88 | this._focusServiceReaction.bind(this), | 89 | this._focusServiceReaction.bind(this), |
@@ -771,7 +772,10 @@ export default class ServicesStore extends Store { | |||
771 | } | 772 | } |
772 | 773 | ||
773 | _shareSettingsWithServiceProcess() { | 774 | _shareSettingsWithServiceProcess() { |
774 | const settings = this.stores.settings.app; | 775 | const settings = { |
776 | ...this.stores.settings.app, | ||
777 | isDarkThemeActive: this.stores.ui.isDarkThemeActive | ||
778 | }; | ||
775 | this.actions.service.sendIPCMessageToAllServices({ | 779 | this.actions.service.sendIPCMessageToAllServices({ |
776 | channel: 'settings-update', | 780 | channel: 'settings-update', |
777 | args: settings, | 781 | args: settings, |
diff --git a/src/stores/UIStore.js b/src/stores/UIStore.js index 7e6f89fed..5b9672798 100644 --- a/src/stores/UIStore.js +++ b/src/stores/UIStore.js | |||
@@ -32,6 +32,7 @@ export default class UIStore extends Store { | |||
32 | 'AppleInterfaceThemeChangedNotification', | 32 | 'AppleInterfaceThemeChangedNotification', |
33 | () => { | 33 | () => { |
34 | this.isOsDarkThemeActive = nativeTheme.shouldUseDarkColors; | 34 | this.isOsDarkThemeActive = nativeTheme.shouldUseDarkColors; |
35 | this.actions.service.shareSettingsWithServiceProcess(); | ||
35 | }, | 36 | }, |
36 | ); | 37 | ); |
37 | } | 38 | } |
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 8ea2fabd9..4e2f5233a 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -127,8 +127,13 @@ class RecipeController { | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | console.log('Set theme to: ', this.settings.service.isDarkModeEnabled ? 'Dark' : 'Light'); | 130 | console.log( |
131 | if (this.settings.service.isDarkModeEnabled) { | 131 | 'Darkmode enabled?', |
132 | this.settings.service.isDarkModeEnabled, | ||
133 | 'Dark theme active?', | ||
134 | this.settings.app.isDarkThemeActive | ||
135 | ); | ||
136 | if (this.settings.service.isDarkModeEnabled && this.settings.app.isDarkThemeActive !== false) { | ||
132 | debug('Enable dark mode'); | 137 | debug('Enable dark mode'); |
133 | 138 | ||
134 | // Check if recipe has a darkmode.css | 139 | // Check if recipe has a darkmode.css |