Skip to content

Commit

Permalink
better gnome integration for gentoo bug 443918 (if gnome-settings-man…
Browse files Browse the repository at this point in the history
…ager is not installed, fail gracefully)
  • Loading branch information
prometheanfire committed Nov 19, 2012
1 parent 688877e commit 09f4423
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions spotify-dbus.py
Expand Up @@ -52,7 +52,7 @@ class Spotify:
size = '48x48'
loop = False
dloop = False
debug = True
debug = False
cache = os.environ['HOME'] + '/.cache/spotify/Covers/'
locale = 'en_US'
player = False
Expand Down Expand Up @@ -490,12 +490,16 @@ def launch(self):

# Media keys
def install_mediakey_handler(self):
bus_object = self.bus.get_object(
'org.gnome.SettingsDaemon', '/org/gnome/SettingsDaemon/MediaKeys')
bus_object.GrabMediaPlayerKeys(
'Spotify', 0, dbus_interface='org.gnome.SettingsDaemon.MediaKeys')
bus_object.connect_to_signal(
'MediaPlayerKeyPressed', self.handle_mediakey)
try:
bus_object = self.bus.get_object(
'org.gnome.SettingsDaemon', '/org/gnome/SettingsDaemon/MediaKeys')
bus_object.GrabMediaPlayerKeys(
'Spotify', 0, dbus_interface='org.gnome.SettingsDaemon.MediaKeys')
bus_object.connect_to_signal(
'MediaPlayerKeyPressed', self.handle_mediakey)
except dbus.DBusException:
if self.debug:
print("Failed to install media key handler (gnome settings daemon not available?)")

def handle_mediakey(self, *mmkeys):
for key in mmkeys:
Expand Down

0 comments on commit 09f4423

Please sign in to comment.