Windows tray theme (#1593)

* images

* use expected theme on windows

* fix shadowing

Co-authored-by: = <=>
This commit is contained in:
Guillermo Vayá
2021-05-10 18:52:23 +02:00
committed by GitHub
parent 3395f7ae4c
commit 47f36294b8
13 changed files with 6 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
// See LICENSE.txt for license information.
import path from 'path';
import {app, nativeImage, Tray, systemPreferences} from 'electron';
import {app, nativeImage, Tray, systemPreferences, nativeTheme} from 'electron';
import {UPDATE_TRAY} from 'common/communication';
@@ -17,12 +17,14 @@ let lastStatus = 'normal';
let lastMessage = app.name;
export function refreshTrayImages(trayIconTheme) {
const winTheme = nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
switch (process.platform) {
case 'win32':
trayImages = {
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray.ico')),
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_unread.ico')),
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_mention.ico')),
normal: nativeImage.createFromPath(path.resolve(assetsDir, `windows/tray_${winTheme}.ico`)),
unread: nativeImage.createFromPath(path.resolve(assetsDir, `windows/tray_${winTheme}_unread.ico`)),
mention: nativeImage.createFromPath(path.resolve(assetsDir, `windows/tray_${winTheme}_mention.ico`)),
};
break;
case 'darwin':