Windows tray theme (#1593) (#1597)

* images

* use expected theme on windows

* fix shadowing

Co-authored-by: = <=>
This commit is contained in:
Guillermo Vayá 2021-05-10 19:04:59 +02:00 committed by GitHub
parent dd516989ff
commit c4b88e56d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 6 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

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':