From 01d75bd6331e2b2b1b436fb746a0d47a9795f75a Mon Sep 17 00:00:00 2001 From: shawnc722 <45184146+shawnc722@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:57:30 -0400 Subject: [PATCH 1/2] add functionality to raise window on mpris method call --- src/main/plugins/mpris.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/plugins/mpris.ts b/src/main/plugins/mpris.ts index 5b9fb6252..af92e1aef 100644 --- a/src/main/plugins/mpris.ts +++ b/src/main/plugins/mpris.ts @@ -74,6 +74,10 @@ export default class mpris { player.on("volume", (volume: string) => { renderer.executeJavaScript(`app.mk.volume = ${parseFloat(volume)}`); }); + player.on("raise", () => { + mpris.utils.getWindow().show(); + mpris.utils.getWindow().focus(); + }); mpris.utils.getIPCMain().on("mpris:playbackTimeDidChange", (event: any, time: number) => { player.getPosition = () => time; From dfd76517a1fde60e0a8c3c2e465e8bf0ab04d073 Mon Sep 17 00:00:00 2001 From: shawnc722 <45184146+shawnc722@users.noreply.github.com> Date: Sun, 28 Apr 2024 08:42:50 -0400 Subject: [PATCH 2/2] since electron tray doesn't support double click on linux, open on single click there --- src/main/base/app.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/base/app.ts b/src/main/base/app.ts index d2d182200..6f04720fc 100644 --- a/src/main/base/app.ts +++ b/src/main/base/app.ts @@ -280,7 +280,7 @@ export class AppEvents { this.tray.setToolTip(app.getName()); this.setTray(false); - this.tray.on("double-click", () => { + this.tray.on("double-click", () => { // supports windows and mac only if (utils.getWindow()) { if (utils.getWindow().isVisible()) { utils.getWindow().focus(); @@ -290,6 +290,16 @@ export class AppEvents { } }); + this.tray.on("click", () => { + if (utils.getWindow() && process.platform === "linux") { // use single click to open when double doesn't work + if (utils.getWindow().isVisible()) { + utils.getWindow().focus(); + } else { + utils.getWindow().show(); + } + } + }); + utils.getWindow().on("show", () => { this.setTray(true); });