mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 04:41:47 +00:00
Override hide(),show(),isVisible from inside plugin
instead of changing source code
This commit is contained in:
3
index.js
3
index.js
@ -286,8 +286,7 @@ app.on("ready", () => {
|
|||||||
// Hide the window instead of quitting (quit is available in tray options)
|
// Hide the window instead of quitting (quit is available in tray options)
|
||||||
if (!forceQuit) {
|
if (!forceQuit) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
mainWindow.minimize()
|
mainWindow.hide();
|
||||||
mainWindow.setSkipTaskbar(true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,20 @@ const getSongInfo = require("../../providers/song-info");
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = win => {
|
module.exports = win => {
|
||||||
|
win.hide = function () {
|
||||||
|
win.minimize()
|
||||||
|
win.setSkipTaskbar(true);}
|
||||||
|
|
||||||
|
win.show = function () {
|
||||||
|
win.restore();
|
||||||
|
win.focus();
|
||||||
|
win.setSkipTaskbar(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
win.isVisible = function () {
|
||||||
|
return !win.isMinimized();
|
||||||
|
}
|
||||||
|
|
||||||
const registerCallback = getSongInfo(win);
|
const registerCallback = getSongInfo(win);
|
||||||
const { playPause, next, previous} = getSongControls(win);
|
const { playPause, next, previous} = getSongControls(win);
|
||||||
|
|
||||||
|
|||||||
10
tray.js
10
tray.js
@ -27,12 +27,8 @@ module.exports.setUpTray = (app, win) => {
|
|||||||
tray.on("click", () => {
|
tray.on("click", () => {
|
||||||
if (config.get("options.trayClickPlayPause")) {
|
if (config.get("options.trayClickPlayPause")) {
|
||||||
playPause();
|
playPause();
|
||||||
} else if(win.isMinimized()){
|
|
||||||
win.restore();
|
|
||||||
win.setSkipTaskbar(false);
|
|
||||||
} else {
|
} else {
|
||||||
win.minimize()
|
win.isVisible() ? win.hide() : win.show();
|
||||||
win.setSkipTaskbar(true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -58,9 +54,7 @@ module.exports.setUpTray = (app, win) => {
|
|||||||
{
|
{
|
||||||
label: "Show",
|
label: "Show",
|
||||||
click: () => {
|
click: () => {
|
||||||
win.restore();
|
win.show();
|
||||||
win.focus();
|
|
||||||
win.setSkipTaskbar(false);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...mainMenuTemplate(win),
|
...mainMenuTemplate(win),
|
||||||
|
|||||||
Reference in New Issue
Block a user