@@ -26,17 +26,17 @@ exports.hasTray = function hasTray() {
2626 return ( trayIcon !== null ) ;
2727} ;
2828
29- exports . create = function ( win , config ) {
29+ exports . create = function ( config ) {
3030 // no trays on darwin
3131 if ( process . platform === 'darwin' || trayIcon ) return ;
3232
3333 const toggleWin = function ( ) {
34- if ( win . isVisible ( ) && ! win . isMinimized ( ) ) {
35- win . hide ( ) ;
34+ if ( global . mainWindow . isVisible ( ) && ! global . mainWindow . isMinimized ( ) ) {
35+ global . mainWindow . hide ( ) ;
3636 } else {
37- if ( win . isMinimized ( ) ) win . restore ( ) ;
38- if ( ! win . isVisible ( ) ) win . show ( ) ;
39- win . focus ( ) ;
37+ if ( global . mainWindow . isMinimized ( ) ) global . mainWindow . restore ( ) ;
38+ if ( ! global . mainWindow . isVisible ( ) ) global . mainWindow . show ( ) ;
39+ global . mainWindow . focus ( ) ;
4040 }
4141 } ;
4242
@@ -60,7 +60,7 @@ exports.create = function(win, config) {
6060 trayIcon . on ( 'click' , toggleWin ) ;
6161
6262 let lastFavicon = null ;
63- win . webContents . on ( 'page-favicon-updated' , async function ( ev , favicons ) {
63+ global . mainWindow . webContents . on ( 'page-favicon-updated' , async function ( ev , favicons ) {
6464 let newFavicon = config . icon_path ;
6565 if ( favicons && favicons . length > 0 && favicons [ 0 ] . startsWith ( 'data:' ) ) {
6666 newFavicon = favicons [ 0 ] ;
@@ -85,10 +85,10 @@ exports.create = function(win, config) {
8585 }
8686
8787 trayIcon . setImage ( newFavicon ) ;
88- win . setIcon ( newFavicon ) ;
88+ global . mainWindow . setIcon ( newFavicon ) ;
8989 } ) ;
9090
91- win . webContents . on ( 'page-title-updated' , function ( ev , title ) {
91+ global . mainWindow . webContents . on ( 'page-title-updated' , function ( ev , title ) {
9292 trayIcon . setToolTip ( title ) ;
9393 } ) ;
9494} ;
0 commit comments