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