#!/bin/sh executeDbusSendForLollypop() { case "$1" in play-pause ) func=PlayPause ;; next ) func=Next ;; previous ) func=Previous ;; * ) exit 3 esac dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.Lollypop /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.$func } if [[ $(ps ax | grep "/usr/bin/lollypop") =~ "python3" ]]; then executeDbusSendForLollypop "$1" else # just start lollypop if not already running lollypop & fi #currentLollypopMetadata=$(qdbus org.mpris.MediaPlayer2.Lollypop /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata) #albumImage=$(sed '1q;d' <<< $currentLollypopMetadata) # first line of output #albumImage=${albumImage#*//} # remove part before // #albumName=$(sed '4q;d' <<< $currentLollypopMetadata) # fourth line of output #albumName=${albumName#*: } # remove part before ": " #artist=$(sed '6q;d' <<< $currentLollypopMetadata) # fourth line of output #artist=${artist#*: } # remove part before ": " #title=$(sed '8q;d' <<< $currentLollypopMetadata) # fourth line of output #title=${title#*: } # remove part before ": " #notify-send "$title" "$artist - $albumName" -i "$albumImage"