0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 22:22:59 +03:00

Open window button in tray

In case click is not work in some distros
This commit is contained in:
Andrey Onishchenko 2024-02-10 20:48:13 +03:00
parent 3eb7fe7816
commit bea5319901
4 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,4 @@
diff --git a/package.json b/package.json
index 5844bdb..c1bab0e 100644
--- a/package.json
+++ b/package.json
@@ -39,5 +39,6 @@

View File

@ -1,5 +1,4 @@
diff --git a/package.json b/package.json
index c1bab0e..d66268b 100644
--- a/package.json
+++ b/package.json
@@ -40,5 +40,9 @@

View File

@ -1,8 +1,7 @@
diff --git a/main/lib/createTray.js b/main/lib/createTray.js
index e69de29..c8b9f0d 100644
--- a/main/lib/createTray.js
+++ b/main/lib/createTray.js
@@ -0,0 +1,19 @@
@@ -0,0 +1,20 @@
+const { app, Menu, Tray, nativeImage } = require('electron');
+const path = require('path');
+
@ -10,7 +9,8 @@ index e69de29..c8b9f0d 100644
+ const iconPath = path.join(__dirname, '../../build/next-desktop/favicon.png');
+ const tray = new Tray(iconPath);
+ const contextMenu = Menu.buildFromTemplate([
+ {label: 'Quit YandexMusic', click: app.quit}
+ {label: 'Open Window', click: () => window.show()},
+ {label: 'Quit YandexMusic', click: () => app.quit()}
+ ]);
+ tray.setToolTip('This is my application.');
+ tray.setContextMenu(contextMenu);
@ -24,7 +24,6 @@ index e69de29..c8b9f0d 100644
+exports.createTray = createTray;
diff --git a/main/index.js b/main/index.js
index 28710d3..a4b3f87 100644
--- a/main/index.js
+++ b/main/index.js
@@ -23,6 +23,7 @@ const handleMetrikaRequests_js_1 = require("./lib/handlers/handleMetrikaRequests

View File

@ -1,5 +1,4 @@
diff --git a/main/lib/createWindow.js b/main/lib/createWindow.js
index 771e24c..e3794a7 100644
--- a/main/lib/createWindow.js
+++ b/main/lib/createWindow.js
@@ -16,8 +16,6 @@ const createWindow = async () => {