mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 13:12:07 +00:00
Merge pull request #677 from th-ch/tray-app-hidden
MacOS: bring back the app in dock when using tray + app hidden
This commit is contained in:
13
tray.js
13
tray.js
@ -1,6 +1,6 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const { Menu, nativeImage, Tray } = require("electron");
|
const { app, Menu, nativeImage, Tray } = require("electron");
|
||||||
|
|
||||||
const config = require("./config");
|
const config = require("./config");
|
||||||
const getSongControls = require("./providers/song-controls");
|
const getSongControls = require("./providers/song-controls");
|
||||||
@ -27,7 +27,13 @@ module.exports.setUpTray = (app, win) => {
|
|||||||
if (config.get("options.trayClickPlayPause")) {
|
if (config.get("options.trayClickPlayPause")) {
|
||||||
playPause();
|
playPause();
|
||||||
} else {
|
} else {
|
||||||
win.isVisible() ? win.hide() : win.show();
|
if (win.isVisible()) {
|
||||||
|
win.hide();
|
||||||
|
app.dock?.hide();
|
||||||
|
} else {
|
||||||
|
win.show();
|
||||||
|
app.dock?.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -54,6 +60,7 @@ module.exports.setUpTray = (app, win) => {
|
|||||||
label: "Show",
|
label: "Show",
|
||||||
click: () => {
|
click: () => {
|
||||||
win.show();
|
win.show();
|
||||||
|
app.dock?.show();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -63,7 +70,7 @@ module.exports.setUpTray = (app, win) => {
|
|||||||
app.quit();
|
app.quit();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ role: "quit" }
|
{ role: "quit" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const trayMenu = Menu.buildFromTemplate(template);
|
const trayMenu = Menu.buildFromTemplate(template);
|
||||||
|
|||||||
Reference in New Issue
Block a user