Gentoo Archives: gentoo-commits

From: Matthew Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/spotify/files/
Date: Fri, 19 Aug 2022 04:52:28
Message-Id: 1660884735.eca6df2ed20259a990b29b59f3548ff5766053e2.prometheanfire@gentoo
1 commit: eca6df2ed20259a990b29b59f3548ff5766053e2
2 Author: Henry Paradiz <henry.paradiz <AT> gmail <DOT> com>
3 AuthorDate: Thu May 26 05:33:01 2022 +0000
4 Commit: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 19 04:52:15 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eca6df2e
7
8 media-sound/spotify: wrapper script should send spotify links with dbus to already running spotify instance
9
10 Bug: https://bugs.gentoo.org/848948
11 Signed-off-by: Henry Paradiz <henry.paradiz <AT> gmail.com>
12 Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>
13
14 media-sound/spotify/files/spotify-wrapper | 45 ++++++++++++++++++++-----------
15 1 file changed, 30 insertions(+), 15 deletions(-)
16
17 diff --git a/media-sound/spotify/files/spotify-wrapper b/media-sound/spotify/files/spotify-wrapper
18 index db8f8b948780..fd6c4f314f9f 100644
19 --- a/media-sound/spotify/files/spotify-wrapper
20 +++ b/media-sound/spotify/files/spotify-wrapper
21 @@ -3,21 +3,36 @@
22 export LD_LIBRARY_PATH="/usr/$LIBDIR/apulse"
23
24 if command -v spotify-dbus.py > /dev/null; then
25 - echo "Launching spotify with Gnome systray integration."
26 - spotify-dbus.py "$@"
27 + echo "Launching spotify with Gnome systray integration."
28 + spotify-dbus.py "$@"
29 elif command -v spotify-tray > /dev/null; then
30 - echo "Launching spotify with generic systray integration."
31 - minimized=
32 - for arg; do
33 - if [ "$arg" = --minimized ]; then
34 - minimized=$arg
35 - break
36 - fi
37 - done
38 - spotify-tray \
39 - --client-path="$SPOTIFY_HOME/spotify" --toggle $minimized -- "$@"
40 + echo "Launching spotify with generic systray integration."
41 + minimized=
42 + for arg; do
43 + if [ "$arg" = --minimized ]; then
44 + minimized=$arg
45 + break
46 + fi
47 + done
48 + spotify-tray \
49 + --client-path="$SPOTIFY_HOME/spotify" --toggle $minimized -- "$@"
50 else
51 - echo "Neither gnome-integration-spotify nor spotify-tray are installed."
52 - echo "Launching spotify without systray integration."
53 - exec "$SPOTIFY_HOME/spotify" "$@"
54 + if pgrep -f "Spotify/[0-9].[0-9].[0-9]" > /dev/null; then
55 + busline="org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri ${1}"
56 + echo "Spotify is already running"
57 + echo "Sending ${busline} to dbus"
58 + if command -v qdbus &> /dev/null; then
59 + qdbus $busline
60 + exit
61 + fi
62 + if command -v dbus-send &> /dev/null; then
63 + dbus-send $busline
64 + exit
65 + fi
66 + echo "No bus dispatcher found."
67 + else
68 + echo "Neither gnome-integration-spotify nor spotify-tray are installed."
69 + echo "Launching spotify without systray integration."
70 + exec "$SPOTIFY_HOME/spotify" "$@"
71 + fi
72 fi