From fbadf09fb5d90127a6dc10b6c8279cc4a395a0e1 Mon Sep 17 00:00:00 2001 From: Max Rumpf Date: Wed, 20 May 2020 21:12:33 +0000 Subject: [PATCH] mpriscontrol plugin should ignore playerctld playerctld (https://github.com/altdesktop/playerctl/issues/161) is a proxy daemon for the currently active player by playerctl, which facilitates managing mpris players, forwarding requests to the currently active/last active player, and sorting out troubles with selecting the correct player manually. Unfortunately, it also creates an annoying issue with kdeconnect: when playing media on the phone, kdeconnect publishes the state to the computer through the mprisremote plugin - then, playerctld picks it up as active player, and registers its own mpris media player. As a result, the mpriscontrol plugin sees this as a running media player, and in turn, publishes the state back to the phone, essentially creating another media session on the phone, resulting in two notifications. As playerctld is _always_ only a proxy to another media player (or kdeconnect), it can safely be ignored, just like kdeconnect itself already is. This commit adds an if check doing exactly that. --- plugins/mpriscontrol/mpriscontrolplugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp index 09ebee162..dc2d1897f 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp @@ -71,6 +71,8 @@ void MprisControlPlugin::serviceOwnerChanged(const QString& serviceName, const Q { if (!serviceName.startsWith(QStringLiteral("org.mpris.MediaPlayer2."))) return; if (serviceName.startsWith(QStringLiteral("org.mpris.MediaPlayer2.kdeconnect."))) return; + // playerctld is a only a proxy to other media players, and can thus safely be ignored + if (serviceName == QStringLiteral("org.mpris.MediaPlayer2.playerctld")) return; if (!oldOwner.isEmpty()) { qCDebug(KDECONNECT_PLUGIN_MPRIS) << "MPRIS service" << serviceName << "just went offline";