mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
Hide the app (no quit) on close if tray enabled
This commit is contained in:
13
index.js
13
index.js
@ -10,6 +10,7 @@ const {
|
||||
autoUpdate,
|
||||
getEnabledPlugins,
|
||||
isAppVisible,
|
||||
isTrayEnabled,
|
||||
store,
|
||||
} = require("./store");
|
||||
const { fileExists, injectCSS } = require("./plugins/utils");
|
||||
@ -187,12 +188,16 @@ app.on("ready", () => {
|
||||
if (!isAppVisible()) {
|
||||
app.dock.hide();
|
||||
}
|
||||
}
|
||||
|
||||
var forceQuit = false;
|
||||
app.on("before-quit", () => {
|
||||
forceQuit = true;
|
||||
});
|
||||
var forceQuit = false;
|
||||
app.on("before-quit", () => {
|
||||
forceQuit = true;
|
||||
});
|
||||
|
||||
if (is.macOS() || isTrayEnabled()) {
|
||||
mainWindow.on("close", (event) => {
|
||||
// Hide the window instead of quitting (quit is available in tray options)
|
||||
if (!forceQuit) {
|
||||
event.preventDefault();
|
||||
mainWindow.hide();
|
||||
|
||||
Reference in New Issue
Block a user