From 551b61a64418e1593659d73961c00f1613bab325 Mon Sep 17 00:00:00 2001 From: Quentin Decaunes Date: Fri, 1 Mar 2019 17:09:09 +0100 Subject: [PATCH] See #1 Fixed tray icon disappearing. --- main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 86ededd..aa6c264 100644 --- a/main.js +++ b/main.js @@ -11,6 +11,7 @@ const {app, BrowserWindow, Menu, Tray} = require('electron') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let mainWindow +let tray function createWindow () { // Create the browser window. @@ -62,8 +63,8 @@ function createWindow () { } ]); - var appIcon = new Tray(__dirname + '/assets/icon.ico'); - appIcon.setContextMenu(contextMenu); + tray = new Tray(__dirname + '/assets/icon.ico'); + tray.setContextMenu(contextMenu); } // This method will be called when Electron has finished