From 8c459ba781d6526509499ad2d1856d2424ed1014 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 4 Sep 2016 19:06:28 +0700 Subject: [PATCH] Added support for Rhythmbox Music Player --- neofetch | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 7a097b80..58feadc7 100755 --- a/neofetch +++ b/neofetch @@ -1223,16 +1223,24 @@ getsong() { song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " & name of current track as string')" state="$(osascript -e 'tell application "iTunes" to player state as string')" + elif [ -n "$(ps x | awk '!(/awk/) && /rhythmbox/')" ]; then + song="$(rhythmbox-client --print-playing)" + # Well, what can you expect? It's dbus after all. + state="$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 \ + org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string: 'PlayBackStatus' |\ + awk -F 'string "' '{printf $2}')" + state="${state//\"}" + else song="Not Playing" fi case "$state" in - "paused" | "PAUSE") + "paused" | "PAUSE" | "Paused") song="Paused" ;; - "stopped" | "STOP") + "stopped" | "STOP" | "Stopped") song="Stopped" ;; esac