File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 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' ) ;
22const { menubar } = require ( 'menubar' ) ;
33const { autoUpdater } = require ( 'electron-updater' ) ;
44const { onFirstRunMaybe } = require ( './first-run' ) ;
@@ -54,6 +54,14 @@ menubarApp.on('ready', () => {
5454
5555 autoUpdater . checkForUpdatesAndNotify ( ) ;
5656
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+
5765 ipcMain . on ( 'reopen-window' , ( ) => menubarApp . showWindow ( ) ) ;
5866 ipcMain . on ( 'app-quit' , ( ) => menubarApp . app . quit ( ) ) ;
5967 ipcMain . on ( 'update-icon' , ( _ , arg ) => {
Original file line number Diff line number Diff line change @@ -11,13 +11,20 @@ import { IconAddAccount } from '../icons/AddAccount';
1111import { IconLogOut } from '../icons/Logout' ;
1212import { IconQuit } from '../icons/Quit' ;
1313import { updateTrayIcon } from '../utils/comms' ;
14+ import { setAppearance } from '../utils/appearance' ;
1415
1516const isLinux = remote . process . platform === 'linux' ;
1617
1718export const SettingsRoute : React . FC = ( ) => {
1819 const { settings, updateSetting, logout } = useContext ( AppContext ) ;
1920 const history = useHistory ( ) ;
2021
22+ ipcRenderer . on ( 'update-native-theme' , ( _ , updatedAppearance : Appearance ) => {
23+ if ( settings . appearance === Appearance . SYSTEM ) {
24+ setAppearance ( updatedAppearance ) ;
25+ }
26+ } ) ;
27+
2128 const logoutUser = useCallback ( ( ) => {
2229 logout ( ) ;
2330 history . goBack ( ) ;
You can’t perform that action at this time.
0 commit comments