mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 11:51:47 +00:00
Setup tray (based on options)
This commit is contained in:
16
index.js
16
index.js
@ -5,9 +5,14 @@ const electron = require("electron");
|
|||||||
const is = require("electron-is");
|
const is = require("electron-is");
|
||||||
const { autoUpdater } = require("electron-updater");
|
const { autoUpdater } = require("electron-updater");
|
||||||
|
|
||||||
const { getEnabledPlugins, store } = require("./store");
|
|
||||||
const { setApplicationMenu } = require("./menu");
|
const { setApplicationMenu } = require("./menu");
|
||||||
|
const {
|
||||||
|
getEnabledPlugins,
|
||||||
|
isAppVisible,
|
||||||
|
store,
|
||||||
|
} = require("./store");
|
||||||
const { fileExists, injectCSS } = require("./plugins/utils");
|
const { fileExists, injectCSS } = require("./plugins/utils");
|
||||||
|
const { setUpTray } = require("./tray");
|
||||||
|
|
||||||
const app = electron.app;
|
const app = electron.app;
|
||||||
|
|
||||||
@ -114,7 +119,9 @@ function createMainWindow() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
win.once("ready-to-show", () => {
|
win.once("ready-to-show", () => {
|
||||||
win.show();
|
if (isAppVisible()) {
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
@ -143,6 +150,7 @@ app.on("ready", () => {
|
|||||||
setApplicationMenu();
|
setApplicationMenu();
|
||||||
mainWindow = createMainWindow();
|
mainWindow = createMainWindow();
|
||||||
if (!is.dev()) {
|
if (!is.dev()) {
|
||||||
|
setUpTray(app, mainWindow);
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
autoUpdater.on("update-available", () => {
|
autoUpdater.on("update-available", () => {
|
||||||
const dialogOpts = {
|
const dialogOpts = {
|
||||||
@ -159,6 +167,10 @@ app.on("ready", () => {
|
|||||||
|
|
||||||
// Optimized for Mac OS X
|
// Optimized for Mac OS X
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
|
if (!isAppVisible()) {
|
||||||
|
app.dock.hide();
|
||||||
|
}
|
||||||
|
|
||||||
var forceQuit = false;
|
var forceQuit = false;
|
||||||
app.on("before-quit", () => {
|
app.on("before-quit", () => {
|
||||||
forceQuit = true;
|
forceQuit = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user