From 52f5c1d727bf07de425dae724c2da54b21cc0374 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Thu, 8 Feb 2024 12:10:55 +0100 Subject: Updated cmusShow.sh to show bluetooth device battery and emojis marking song, artist and record. --- cmusShow.sh | 28 ++++++++++++++++++++++++---- 1 file 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 -- cgit v1.2.1