Override hide(),show(),isVisible from inside plugin

instead of changing source code
This commit is contained in:
Araxeus
2021-03-22 04:01:19 +02:00
parent df8c77cd3e
commit 6427b3406c
4 changed files with 17 additions and 9085 deletions

View File

@ -286,8 +286,7 @@ app.on("ready", () => {
// Hide the window instead of quitting (quit is available in tray options)
if (!forceQuit) {
event.preventDefault();
mainWindow.minimize()
mainWindow.setSkipTaskbar(true);
mainWindow.hide();
}
});
}

View File

@ -3,6 +3,20 @@ const getSongInfo = require("../../providers/song-info");
const path = require('path');
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 { playPause, next, previous} = getSongControls(win);

10
tray.js
View File

@ -27,12 +27,8 @@ module.exports.setUpTray = (app, win) => {
tray.on("click", () => {
if (config.get("options.trayClickPlayPause")) {
playPause();
} else if(win.isMinimized()){
win.restore();
win.setSkipTaskbar(false);
} else {
win.minimize()
win.setSkipTaskbar(true);
win.isVisible() ? win.hide() : win.show();
}
});
@ -58,9 +54,7 @@ module.exports.setUpTray = (app, win) => {
{
label: "Show",
click: () => {
win.restore();
win.focus();
win.setSkipTaskbar(false);
win.show();
},
},
...mainMenuTemplate(win),

9075
yarn.lock

File diff suppressed because it is too large Load Diff