Initial commit
This commit is contained in:
commit
2cf8bfa94c
|
@ -0,0 +1,6 @@
|
||||||
|
# GNOME Now Playing #
|
||||||
|
|
||||||
|
This script uses [Argos](https://github.com/p-e-w/argos) to display a Now Playing panel that fetches
|
||||||
|
the current song artist and title using MPRIS (D-Bus).
|
||||||
|
|
||||||
|
To install, put the script in `~/.config/argos/`
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MPRIS_ROOT='org.mpris.MediaPlayer2.*'
|
||||||
|
MPRIS_PATH='/org/mpris/MediaPlayer2'
|
||||||
|
DBUS_GET='org.freedesktop.DBus.Properties.Get'
|
||||||
|
MPRIS_PLAYER='org.mpris.MediaPlayer2.Player'
|
||||||
|
XESAM_ARTIST="xesam:albumArtist: "
|
||||||
|
XESAM_ARTIST2="xesam:artist: "
|
||||||
|
XESAM_TITLE="xesam:title: "
|
||||||
|
|
||||||
|
for player in $(qdbus $MPRIS_ROOT); do
|
||||||
|
state=$(qdbus "$player" $MPRIS_PATH $DBUS_GET $MPRIS_PLAYER PlaybackStatus)
|
||||||
|
if [ "$state" == "Playing" ]; then
|
||||||
|
metadata=$(qdbus "$player" $MPRIS_PATH $DBUS_GET $MPRIS_PLAYER Metadata)
|
||||||
|
artist=$(echo "$metadata" | grep "$XESAM_ARTIST")
|
||||||
|
artist=${artist#"$XESAM_ARTIST"}
|
||||||
|
artist2=$(echo "$metadata" | grep "$XESAM_ARTIST2")
|
||||||
|
artist2=${artist2#"$XESAM_ARTIST2"}
|
||||||
|
title=$(echo "$metadata" | grep "$XESAM_TITLE")
|
||||||
|
title=${title#"$XESAM_TITLE"}
|
||||||
|
if [ "$title" != "" ]; then
|
||||||
|
if [ "$artist" == "" ]; then
|
||||||
|
if [ "$artist2" == "" ]; then
|
||||||
|
echo "$title | iconName=multimedia-audio-player-symbolic"
|
||||||
|
else
|
||||||
|
echo "$artist2 - $title | iconName=multimedia-audio-player-symbolic"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$artist - $title | iconName=multimedia-audio-player-symbolic"
|
||||||
|
fi
|
||||||
|
echo "---"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "---"
|
Loading…
Reference in New Issue