From f726300ca59a4a7d8f697589247cd15a2e7c706d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Mand=C3=A1k?= Date: Sun, 18 Jan 2015 19:51:55 +0100 Subject: [PATCH] Fixed freezing on mouse events when player is not running. Fixed color when player is not running. --- i3pystatus/now_playing.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/i3pystatus/now_playing.py b/i3pystatus/now_playing.py index a413130..b75104c 100644 --- a/i3pystatus/now_playing.py +++ b/i3pystatus/now_playing.py @@ -120,7 +120,7 @@ class NowPlaying(IntervalModule): else: self.output = { "full_text": self.format_no_player, - "color": self.color, + "color": self.color_no_player, } return @@ -135,7 +135,17 @@ class NowPlaying(IntervalModule): return def playpause(self): - dbus.Interface(self.get_player(), "org.mpris.MediaPlayer2.Player").PlayPause() + try: + dbus.Interface(self.get_player(), "org.mpris.MediaPlayer2.Player").PlayPause() + except NoPlayerException: + return + except dbus.exceptions.DBusException: + return def next_song(self): - dbus.Interface(self.get_player(), "org.mpris.MediaPlayer2.Player").Next() + try: + dbus.Interface(self.get_player(), "org.mpris.MediaPlayer2.Player").Next() + except NoPlayerException: + return + except dbus.exceptions.DBusException: + return