Skip to content

Commit 2f218ef

Browse files
authored
Merge pull request #677 from th-ch/tray-app-hidden
MacOS: bring back the app in dock when using tray + app hidden
2 parents 7359010 + de14d64 commit 2f218ef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tray.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require("path");
22

3-
const { Menu, nativeImage, Tray } = require("electron");
3+
const { app, Menu, nativeImage, Tray } = require("electron");
44

55
const config = require("./config");
66
const getSongControls = require("./providers/song-controls");
@@ -27,7 +27,13 @@ module.exports.setUpTray = (app, win) => {
2727
if (config.get("options.trayClickPlayPause")) {
2828
playPause();
2929
} else {
30-
win.isVisible() ? win.hide() : win.show();
30+
if (win.isVisible()) {
31+
win.hide();
32+
app.dock?.hide();
33+
} else {
34+
win.show();
35+
app.dock?.show();
36+
}
3137
}
3238
});
3339

@@ -54,6 +60,7 @@ module.exports.setUpTray = (app, win) => {
5460
label: "Show",
5561
click: () => {
5662
win.show();
63+
app.dock?.show();
5764
},
5865
},
5966
{
@@ -63,7 +70,7 @@ module.exports.setUpTray = (app, win) => {
6370
app.quit();
6471
},
6572
},
66-
{ role: "quit" }
73+
{ role: "quit" },
6774
];
6875

6976
const trayMenu = Menu.buildFromTemplate(template);

0 commit comments

Comments
 (0)