diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2024-02-08 12:10:55 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2024-02-08 12:10:55 +0100 |
commit | 52f5c1d727bf07de425dae724c2da54b21cc0374 (patch) | |
tree | 1abf97b55e3ba5c52fc5f781d3a708c98ecaab79 | |
parent | 4c4d9d895a3cc502ce68f07022e1c4c28a703920 (diff) | |
download | scripts-52f5c1d727bf07de425dae724c2da54b21cc0374.tar.gz scripts-52f5c1d727bf07de425dae724c2da54b21cc0374.zip |
Updated cmusShow.sh to show bluetooth device battery and emojis marking song, artist and record.
-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 |