diff options
-rwxr-xr-x | cmusShow.sh | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/cmusShow.sh b/cmusShow.sh index 8a5c576..8e36b3b 100755 --- a/cmusShow.sh +++ b/cmusShow.sh @@ -7,6 +7,7 @@ scriptName="${0##*/}" notificationFreq=0.1 steps=20 +bluetoothInfo='' getCmusInfo() { cmus-remote -Q | grep "^${1} " | cut -d' ' -f "${2}-" @@ -19,14 +20,33 @@ sToTime() { echo "${min}:${s}" } +if bluetoothctl info; then + device="π» $(bluetoothctl info | + grep 'Name: ' | + cut -d' ' -f '2-')" + battery="$(bluetoothctl info | + grep 'Battery Percentage:' | + grep -o '(.*)' | + grep -o '[0-9]*')% π" + bluetoothInfo="\n${device} - ${battery}" +fi + + i=0 while [ "$i" -lt "$steps" ]; do - artist="$(getCmusInfo 'tag artist' '3')" - album="$(getCmusInfo 'tag album' '3')" - title="$(getCmusInfo 'tag title' '3')" + + playingIcon='' + [ "$(getCmusInfo 'status' 2)" = 'playing' ] && playingIcon='βΆοΈ' + [ "$(getCmusInfo 'status' 2)" = 'paused' ] && playingIcon='βΈοΈ' + + title="πΆ $(getCmusInfo 'tag title' '3') πΆ" + artist="π§βπ€ $(getCmusInfo 'tag artist' '3')" + album="$(getCmusInfo 'tag album' '3') π½" position="$(getCmusInfo 'position' '2')" duration="$(getCmusInfo 'duration' '2')" - dunstify -r "$(dunstifyIDs.sh cmusShow)" -t 250 "${title}" "${artist} - ${album}\n$(sToTime "${position}") - $(sToTime "${duration}")" + + dunstify -r "$(dunstifyIDs.sh cmusShow)" -t 250 "${title}" "${artist} - ${album}\n${playingIcon} $(sToTime "${position}") - $(sToTime "${duration}")${bluetoothInfo}" + sleep "$notificationFreq" i=$((i+1)) done |