aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2024-02-08 12:10:55 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2024-02-08 12:10:55 +0100
commit52f5c1d727bf07de425dae724c2da54b21cc0374 (patch)
tree1abf97b55e3ba5c52fc5f781d3a708c98ecaab79
parent4c4d9d895a3cc502ce68f07022e1c4c28a703920 (diff)
downloadscripts-52f5c1d727bf07de425dae724c2da54b21cc0374.tar.gz
scripts-52f5c1d727bf07de425dae724c2da54b21cc0374.zip
Updated cmusShow.sh to show bluetooth device battery and emojis marking song, artist and record.
-rwxr-xr-xcmusShow.sh28
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