fix: refresh icon after turning on/off + switching dark-mode

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman committed 2020-10-07 14:01:20 +03:00
1 parent 43ea13cfc3
commit fc20733dde
2 files changed
+5 -5

No files matched your search

+2 -3
View File
@@ -31,9 +31,8 @@ nativeTheme.on("updated", async () => {
});
export async function initTray(windowManager: WindowManager) {
if (!trayIcon) {
trayIcon = await createTrayIconFromSvg();
}
trayIcon = await createTrayIconFromSvg(); // generate icon once on tray activation
const dispose = autorun(() => {
const menu = createTrayMenu(windowManager);
buildTray(trayIcon, menu);
+3 -2
View File
@@ -59,8 +59,9 @@ export class WindowManager {
this.disposers.trayAutoBind = reaction(() => userStore.preferences.trayEnabled, async isEnabled => {
if (isEnabled) {
this.disposers.trayAutoUpdater = await initTray(this);
} else {
this.disposers?.trayAutoUpdater();
} else if (this.disposers.trayAutoUpdater) {
this.disposers.trayAutoUpdater();
this.disposers.trayAutoUpdater = null;
}
}, {
fireImmediately: true