diff --git a/index.js b/index.js index d146d90a07..40ed1abc52 100644 --- a/index.js +++ b/index.js @@ -166,7 +166,10 @@ app.on("activate", () => { app.on("ready", () => { setApplicationMenu(); mainWindow = createMainWindow(); - setUpTray(app, mainWindow); + const tray = setUpTray(app, mainWindow); + tray.on("click", () => { + mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show(); + }); if (!is.dev() && autoUpdate()) { autoUpdater.checkForUpdatesAndNotify(); diff --git a/tray.js b/tray.js index d36c091166..3a32085e7c 100644 --- a/tray.js +++ b/tray.js @@ -22,6 +22,7 @@ module.exports.setUpTray = (app, win) => { }); tray = new Tray(trayIcon); tray.setToolTip("Youtube Music"); + tray.setIgnoreDoubleClickEvents(true); const trayMenu = Menu.buildFromTemplate([ { @@ -66,4 +67,6 @@ module.exports.setUpTray = (app, win) => { }, ]); tray.setContextMenu(trayMenu); + + return tray; };