fix: 部分linux发行版环境的托盘行为 (#1647)

master
memorydream 3 years ago committed by GitHub
parent c1efcb895c
commit bbbd729fdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;

Loading…
Cancel
Save