summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Paradiz <henry.paradiz@gmail.com>2022-05-25 22:33:01 -0700
committerMatthew Thode <prometheanfire@gentoo.org>2022-08-18 23:52:15 -0500
commiteca6df2ed20259a990b29b59f3548ff5766053e2 (patch)
tree40b5eb0abc766834d8c1cf1bdbb5d868ff4ccd54 /media-sound/spotify/files
parentsys-apps/systemd-utils: add github upstream metadata (diff)
downloadgentoo-eca6df2ed20259a990b29b59f3548ff5766053e2.tar.gz
gentoo-eca6df2ed20259a990b29b59f3548ff5766053e2.tar.bz2
gentoo-eca6df2ed20259a990b29b59f3548ff5766053e2.zip
media-sound/spotify: wrapper script should send spotify links with dbus to already running spotify instance
Bug: https://bugs.gentoo.org/848948 Signed-off-by: Henry Paradiz <henry.paradiz@gmail.com> Signed-off-by: Matthew Thode <prometheanfire@gentoo.org>
Diffstat (limited to 'media-sound/spotify/files')
-rw-r--r--media-sound/spotify/files/spotify-wrapper45
1 files changed, 30 insertions, 15 deletions
diff --git a/media-sound/spotify/files/spotify-wrapper b/media-sound/spotify/files/spotify-wrapper
index db8f8b948780..fd6c4f314f9f 100644
--- a/media-sound/spotify/files/spotify-wrapper
+++ b/media-sound/spotify/files/spotify-wrapper
@@ -3,21 +3,36 @@
export LD_LIBRARY_PATH="/usr/$LIBDIR/apulse"
if command -v spotify-dbus.py > /dev/null; then
- echo "Launching spotify with Gnome systray integration."
- spotify-dbus.py "$@"
+ echo "Launching spotify with Gnome systray integration."
+ spotify-dbus.py "$@"
elif command -v spotify-tray > /dev/null; then
- echo "Launching spotify with generic systray integration."
- minimized=
- for arg; do
- if [ "$arg" = --minimized ]; then
- minimized=$arg
- break
- fi
- done
- spotify-tray \
- --client-path="$SPOTIFY_HOME/spotify" --toggle $minimized -- "$@"
+ echo "Launching spotify with generic systray integration."
+ minimized=
+ for arg; do
+ if [ "$arg" = --minimized ]; then
+ minimized=$arg
+ break
+ fi
+ done
+ spotify-tray \
+ --client-path="$SPOTIFY_HOME/spotify" --toggle $minimized -- "$@"
else
- echo "Neither gnome-integration-spotify nor spotify-tray are installed."
- echo "Launching spotify without systray integration."
- exec "$SPOTIFY_HOME/spotify" "$@"
+ if pgrep -f "Spotify/[0-9].[0-9].[0-9]" > /dev/null; then
+ busline="org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri ${1}"
+ echo "Spotify is already running"
+ echo "Sending ${busline} to dbus"
+ if command -v qdbus &> /dev/null; then
+ qdbus $busline
+ exit
+ fi
+ if command -v dbus-send &> /dev/null; then
+ dbus-send $busline
+ exit
+ fi
+ echo "No bus dispatcher found."
+ else
+ echo "Neither gnome-integration-spotify nor spotify-tray are installed."
+ echo "Launching spotify without systray integration."
+ exec "$SPOTIFY_HOME/spotify" "$@"
+ fi
fi