Fixes for macos

This commit is contained in:
Andrew 2022-12-23 21:03:58 +06:00
parent 55d9517242
commit 1b3f0bdefd
2 changed files with 11 additions and 1 deletions

12
main.js
View File

@ -41,6 +41,7 @@ function createWindow() {
if (!isQuiting && trayEnabled) {
event.preventDefault();
win.hide();
if (app.dock) app.dock.hide();
}
return false;
});
@ -81,6 +82,7 @@ app.whenReady().then(() => {
label: i18n("Open app"),
click() {
win.show();
if (app.dock) app.dock.show()
},
},
{
@ -122,12 +124,20 @@ app.whenReady().then(() => {
]);
let trayInUse = false;
let icon;
if (process.platform == "win32") {
icon = __dirname + "/resources/icon.ico";
} else if (process.platform == "darwin") {
icon = __dirname + "/resources/icons/16x16.png";
} else {
icon = __dirname + "/resources/icon.png";
}
ipcMain.on("useTray", (_, enabled) => {
if (enabled && !trayInUse) {
console.log("Using tray");
trayEnabled = true;
trayInUse = true;
tray = new Tray(__dirname + "/assets/images/icon.png");
tray = new Tray(icon);
tray.setToolTip("ytDownloader");
tray.setContextMenu(contextMenu);
} else if (!enabled) {

BIN
resources/icons/16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B