diff options
| author | Peter Son Struschka <me@peter-struschka.com> | 2019-05-11 15:53:16 +0700 |
|---|---|---|
| committer | Peter Son Struschka <me@peter-struschka.com> | 2019-05-11 15:53:16 +0700 |
| commit | 5bca040f13556d13b80a91a43b0b88ca9c21b218 (patch) | |
| tree | efdc704586f382f4bdb2baa2cc6f4f353b717f1d /i3wm/.bin | |
| parent | c4f5fd984a863aa284de476e3ef6515affa7eb49 (diff) | |
| download | dotfiles-5bca040f13556d13b80a91a43b0b88ca9c21b218.tar.gz dotfiles-5bca040f13556d13b80a91a43b0b88ca9c21b218.tar.bz2 dotfiles-5bca040f13556d13b80a91a43b0b88ca9c21b218.tar.lz dotfiles-5bca040f13556d13b80a91a43b0b88ca9c21b218.tar.xz dotfiles-5bca040f13556d13b80a91a43b0b88ca9c21b218.tar.zst dotfiles-5bca040f13556d13b80a91a43b0b88ca9c21b218.zip | |
update makefile and configs
Diffstat (limited to 'i3wm/.bin')
| -rwxr-xr-x | i3wm/.bin/spotifycl | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/i3wm/.bin/spotifycl b/i3wm/.bin/spotifycl index 4cd6943..78d60d6 100755 --- a/i3wm/.bin/spotifycl +++ b/i3wm/.bin/spotifycl @@ -50,6 +50,7 @@ server_address = '/tmp/spotifycl-socket' class Spotify: SPOTIFY_BUS = 'org.mpris.MediaPlayer2.spotify' + SPOTIFYD_BUS = 'org.mpris.MediaPlayer2.spotifyd' SPOTIFY_OBJECT_PATH = '/org/mpris/MediaPlayer2' PLAYER_INTERFACE = 'org.mpris.MediaPlayer2.Player' @@ -81,7 +82,7 @@ class Spotify: self.freedesktop.connect_to_signal( "NameOwnerChanged", self.on_name_owner_changed, - arg0="org.mpris.MediaPlayer2.spotify" + arg0=self.SPOTIFYD_BUS ) executor = ThreadPoolExecutor(max_workers=2) @@ -197,10 +198,13 @@ class Spotify: self.last_output = line def setup_spotify(self): - self.spotify = self.session_bus.get_object( - Spotify.SPOTIFY_BUS, - Spotify.SPOTIFY_OBJECT_PATH - ) + try: + self.spotify = self.session_bus.get_object( + Spotify.SPOTIFY_BUS, + Spotify.SPOTIFY_OBJECT_PATH + ) + except dbus.DBusException: + self.spotify = self.session_bus.get_object(Spotify.SPOTIFYD_BUS, Spotify.SPOTIFY_OBJECT_PATH) def setup_properties_changed(self): try: @@ -265,7 +269,7 @@ class Spotify: self.output_playback_status(data) def on_name_owner_changed(self, name, old_owner, new_owner): - if name == 'org.mpris.MediaPlayer2.spotify': + if name == self.SPOTIFY_BUS: if new_owner: # Spotify was opened. self.setup_properties_changed() |
