File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
- const { ipcMain, app } = require ( 'electron' ) ;
1
+ const { ipcMain, app, nativeTheme } = require ( 'electron' ) ;
2
2
const { menubar } = require ( 'menubar' ) ;
3
3
const { autoUpdater } = require ( 'electron-updater' ) ;
4
4
const { onFirstRunMaybe } = require ( './first-run' ) ;
@@ -54,6 +54,14 @@ menubarApp.on('ready', () => {
54
54
55
55
autoUpdater . checkForUpdatesAndNotify ( ) ;
56
56
57
+ nativeTheme . on ( 'updated' , ( ) => {
58
+ if ( nativeTheme . shouldUseDarkColors ) {
59
+ menubarApp . window . webContents . send ( 'update-native-theme' , 'DARK' ) ;
60
+ } else {
61
+ menubarApp . window . webContents . send ( 'update-native-theme' , 'LIGHT' ) ;
62
+ }
63
+ } ) ;
64
+
57
65
ipcMain . on ( 'reopen-window' , ( ) => menubarApp . showWindow ( ) ) ;
58
66
ipcMain . on ( 'app-quit' , ( ) => menubarApp . app . quit ( ) ) ;
59
67
ipcMain . on ( 'update-icon' , ( _ , arg ) => {
Original file line number Diff line number Diff line change @@ -11,13 +11,20 @@ import { IconAddAccount } from '../icons/AddAccount';
11
11
import { IconLogOut } from '../icons/Logout' ;
12
12
import { IconQuit } from '../icons/Quit' ;
13
13
import { updateTrayIcon } from '../utils/comms' ;
14
+ import { setAppearance } from '../utils/appearance' ;
14
15
15
16
const isLinux = remote . process . platform === 'linux' ;
16
17
17
18
export const SettingsRoute : React . FC = ( ) => {
18
19
const { settings, updateSetting, logout } = useContext ( AppContext ) ;
19
20
const history = useHistory ( ) ;
20
21
22
+ ipcRenderer . on ( 'update-native-theme' , ( _ , updatedAppearance : Appearance ) => {
23
+ if ( settings . appearance === Appearance . SYSTEM ) {
24
+ setAppearance ( updatedAppearance ) ;
25
+ }
26
+ } ) ;
27
+
21
28
const logoutUser = useCallback ( ( ) => {
22
29
logout ( ) ;
23
30
history . goBack ( ) ;
You can’t perform that action at this time.
0 commit comments