2024-02-09 23:13:29 +03:00
|
|
|
diff --git a/main/lib/createTray.js b/main/lib/createTray.js
|
|
|
|
--- a/main/lib/createTray.js
|
|
|
|
+++ b/main/lib/createTray.js
|
2024-02-10 20:48:13 +03:00
|
|
|
@@ -0,0 +1,20 @@
|
2024-02-10 19:14:52 +03:00
|
|
|
+const { app, Menu, Tray, nativeImage } = require('electron');
|
|
|
|
+const path = require('path');
|
2024-02-09 23:13:29 +03:00
|
|
|
+
|
|
|
|
+function createTray(window) {
|
2024-02-10 19:14:52 +03:00
|
|
|
+ const iconPath = path.join(__dirname, '../../build/next-desktop/favicon.png');
|
|
|
|
+ const tray = new Tray(iconPath);
|
2024-02-09 23:13:29 +03:00
|
|
|
+ const contextMenu = Menu.buildFromTemplate([
|
2024-02-20 16:10:09 +03:00
|
|
|
+ {label: 'Открыть', click: () => window.show()},
|
|
|
|
+ {label: 'Закрыть Яндекс Музыку', click: () => app.quit()}
|
2024-02-09 23:13:29 +03:00
|
|
|
+ ]);
|
2024-02-20 16:10:09 +03:00
|
|
|
+ tray.setToolTip('Яндекс Музыка');
|
2024-02-09 23:13:29 +03:00
|
|
|
+ tray.setContextMenu(contextMenu);
|
|
|
|
+
|
|
|
|
+ tray.on('click', () => {
|
|
|
|
+ window.show();
|
|
|
|
+ });
|
|
|
|
+ tray.setIgnoreDoubleClickEvents(true);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+exports.createTray = createTray;
|
|
|
|
|
|
|
|
diff --git a/main/index.js b/main/index.js
|
|
|
|
--- a/main/index.js
|
|
|
|
+++ b/main/index.js
|
|
|
|
@@ -23,6 +23,7 @@ const handleMetrikaRequests_js_1 = require("./lib/handlers/handleMetrikaRequests
|
|
|
|
const loadURL_js_1 = require("./lib/loadURL.js");
|
|
|
|
const safeRedirects_js_1 = require("./lib/safeRedirects.js");
|
|
|
|
const handleWindowSessionEvents_js_1 = require("./lib/handlers/handleWindowSessionEvents.js");
|
|
|
|
+const {createTray} = require('./lib/createTray.js');
|
|
|
|
(0, handleError_js_1.handleUncaughtException)();
|
|
|
|
(0, singleInstance_js_1.checkForSingleInstance)();
|
|
|
|
(0, handleDeeplink_js_1.handleDeeplinkOnApplicationStartup)();
|
|
|
|
@@ -30,6 +31,7 @@ const handleWindowSessionEvents_js_1 = require("./lib/handlers/handleWindowSessi
|
|
|
|
await electron_1.app.whenReady();
|
|
|
|
(0, menu_js_1.setupMenu)();
|
|
|
|
const window = await (0, createWindow_js_1.createWindow)();
|
|
|
|
+ createTray(window);
|
|
|
|
(0, safeRedirects_js_1.safeRedirects)(window);
|
|
|
|
(0, handleWindowLifecycleEvents_js_1.handleWindowLifecycleEvents)(window);
|
|
|
|
(0, handleWindowSessionEvents_js_1.handleWindowSessionEvents)(window);
|