From 6161d591d2e55b8bc46d0d04cb878b9ff73f3d92 Mon Sep 17 00:00:00 2001 From: Jo De Boeck Date: Thu, 24 Mar 2016 21:25:27 +0200 Subject: [PATCH] Now Playing: Check for mpris service in activatable services --- i3pystatus/now_playing.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/i3pystatus/now_playing.py b/i3pystatus/now_playing.py index 2fecf65..1c066de 100644 --- a/i3pystatus/now_playing.py +++ b/i3pystatus/now_playing.py @@ -70,8 +70,14 @@ class NowPlaying(IntervalModule): def find_player(self): obj = dbus.SessionBus().get_object("org.freedesktop.DBus", "/org/freedesktop/DBus") - method = obj.get_dbus_method('ListNames', 'org.freedesktop.DBus') - players = [a for a in method() if a.startswith("org.mpris.MediaPlayer2.")] + + def get_players(methodname): + method = obj.get_dbus_method(methodname, 'org.freedesktop.DBus') + return [a for a in method() if a.startswith("org.mpris.MediaPlayer2.")] + + players = get_players('ListNames') + if not players: + players = get_players('ListActivatableNames') if self.old_player in players: return self.old_player if not players: