mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 12:42:06 +00:00
Show/hide window when clicking on tray
This commit is contained in:
5
index.js
5
index.js
@ -166,7 +166,10 @@ app.on("activate", () => {
|
|||||||
app.on("ready", () => {
|
app.on("ready", () => {
|
||||||
setApplicationMenu();
|
setApplicationMenu();
|
||||||
mainWindow = createMainWindow();
|
mainWindow = createMainWindow();
|
||||||
setUpTray(app, mainWindow);
|
const tray = setUpTray(app, mainWindow);
|
||||||
|
tray.on("click", () => {
|
||||||
|
mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show();
|
||||||
|
});
|
||||||
|
|
||||||
if (!is.dev() && autoUpdate()) {
|
if (!is.dev() && autoUpdate()) {
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
|||||||
3
tray.js
3
tray.js
@ -22,6 +22,7 @@ module.exports.setUpTray = (app, win) => {
|
|||||||
});
|
});
|
||||||
tray = new Tray(trayIcon);
|
tray = new Tray(trayIcon);
|
||||||
tray.setToolTip("Youtube Music");
|
tray.setToolTip("Youtube Music");
|
||||||
|
tray.setIgnoreDoubleClickEvents(true);
|
||||||
|
|
||||||
const trayMenu = Menu.buildFromTemplate([
|
const trayMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
@ -66,4 +67,6 @@ module.exports.setUpTray = (app, win) => {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
tray.setContextMenu(trayMenu);
|
tray.setContextMenu(trayMenu);
|
||||||
|
|
||||||
|
return tray;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user