From eaf9d310aa123ac1ee65ed50e8e548b0a259c166 Mon Sep 17 00:00:00 2001 From: Andreas Angerer <6475757+andia89@users.noreply.github.com> Date: Sat, 25 May 2024 01:36:52 +0200 Subject: [PATCH] fix(MPRIS): Prevents player to start with invalid MPRIS interface (#1996) Co-authored-by: andreas --- src/plugins/shortcuts/main.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/shortcuts/main.ts b/src/plugins/shortcuts/main.ts index 89ce111e..84c29899 100644 --- a/src/plugins/shortcuts/main.ts +++ b/src/plugins/shortcuts/main.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, globalShortcut } from 'electron'; +import { BrowserWindow, ipcMain, globalShortcut } from 'electron'; import is from 'electron-is'; import { register as registerElectronLocalShortcut } from 'electron-localshortcut'; @@ -48,7 +48,9 @@ export const onMainLoad = async ({ _registerLocalShortcut(window, 'CommandOrControl+L', search); if (is.linux()) { - registerMPRIS(window); + ipcMain.once('ytmd:video-src-changed', (_) => { + registerMPRIS(window); + }); } const { global, local } = config;