From bbbd729fdfefac5b3f2abc3751c5262a5a71d464 Mon Sep 17 00:00:00 2001 From: memorydream <34763046+memorydream@users.noreply.github.com> Date: Sat, 21 May 2022 06:03:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=83=A8=E5=88=86linux=E5=8F=91?= =?UTF-8?q?=E8=A1=8C=E7=89=88=E7=8E=AF=E5=A2=83=E7=9A=84=E6=89=98=E7=9B=98?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=20(#1647)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/electron/tray.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/electron/tray.js b/src/electron/tray.js index 6afa580..ba74d3c 100644 --- a/src/electron/tray.js +++ b/src/electron/tray.js @@ -97,6 +97,10 @@ function createMenuTemplate(win) { // click在默认行为下会弹出一个contextMenu,里面的唯一选项才会调用click事件 // setContextMenu应该是目前唯一能在linux下使用托盘菜单api // 但是无法区分鼠标左右键 + +// 发现openSUSE KDE环境可以区分鼠标左右键 +// 添加左键支持 +// 2022.05.17 class YPMTrayLinuxImpl { constructor(tray, win, emitter) { this.tray = tray; @@ -127,6 +131,10 @@ class YPMTrayLinuxImpl { } handleEvents() { + this.tray.on('click', () => { + this.win.show(); + }); + this.emitter.on('updateTooltip', title => this.tray.setToolTip(title)); this.emitter.on('updatePlayState', isPlaying => { this.contextMenu.getMenuItemById('play').visible = !isPlaying;