#!/bin/sh # Shows a notification with info about the current playing song. getCmusInfo() { cmus-remote -Q | grep "^${1} " | cut -d' ' -f "${2}-" } sToTime() { min=$(( $1 / 60 )) s=$(( $1 % 60 )) [ "$s" -lt 10 ] && s="0${s}" echo "${min}:${s}" } artist="$(getCmusInfo 'tag artist' '3')" album="$(getCmusInfo 'tag album' '3')" title="$(getCmusInfo 'tag title' '3')" position="$(getCmusInfo 'position' '2')" duration="$(getCmusInfo 'duration' '2')" dunstify -r "$(dunstifyIDs.sh cmusShow)" "${title}" "${artist} - ${album}\n$(sToTime ${position}) - $(sToTime ${duration})"