Skip to content

Commit 4824dda

Browse files
committed
Move tray click callback in setUpTray
1 parent 3fa3c3a commit 4824dda

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,7 @@ app.on("activate", () => {
166166
app.on("ready", () => {
167167
setApplicationMenu();
168168
mainWindow = createMainWindow();
169-
const tray = setUpTray(app, mainWindow);
170-
tray.on("click", () => {
171-
mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show();
172-
});
169+
setUpTray(app, mainWindow);
173170

174171
if (!is.dev() && autoUpdate()) {
175172
autoUpdater.checkForUpdatesAndNotify();

tray.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ module.exports.setUpTray = (app, win) => {
2323
tray = new Tray(trayIcon);
2424
tray.setToolTip("Youtube Music");
2525
tray.setIgnoreDoubleClickEvents(true);
26+
tray.on("click", () => {
27+
win.isVisible() ? win.hide() : win.show();
28+
});
2629

2730
const trayMenu = Menu.buildFromTemplate([
2831
{
@@ -67,6 +70,4 @@ module.exports.setUpTray = (app, win) => {
6770
},
6871
]);
6972
tray.setContextMenu(trayMenu);
70-
71-
return tray;
7273
};

0 commit comments

Comments
 (0)