aboutsummaryrefslogtreecommitdiff
path: root/cmusShow.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cmusShow.sh')
-rwxr-xr-xcmusShow.sh15
1 files changed, 8 insertions, 7 deletions
diff --git a/cmusShow.sh b/cmusShow.sh
index 4382e68..2df27a6 100755
--- a/cmusShow.sh
+++ b/cmusShow.sh
@@ -3,10 +3,10 @@
# Shows a notification with info about the currently playing song.
scriptName="${0##*/}"
-[ "$(pgrep "${scriptName}" | wc -l)" -gt "2" ] && exit 0
+[ "$(pgrep "${scriptName}" | wc -l)" -gt "2" ] && pkill "$scriptName" && exit 0
notificationFreq=0.5
-steps=10
+#steps=10
iconSize='128'
bluetoothInfo=''
@@ -38,7 +38,7 @@ albumIcon="$(getAlbumIcon)"
# Bluetooth info
-if bluetoothctl info; then
+if systemctl is-active bluetooth --quiet && bluetoothctl info; then
device="📻 $(bluetoothctl info |
grep 'Name: ' |
cut -d' ' -f '2-')"
@@ -50,17 +50,18 @@ if bluetoothctl info; then
fi
playingIcon=''
-i=0
-while [ "$i" -lt "$steps" ]; do
+#i=0
+#while [ "$i" -lt "$steps" ]; do
+while true; do
currentlyPlayingFile="$(getCmusInfo 'file' '2')"
if [ "$currentlyPlayingFile" != "$playingFile" ]; then
+ playingFile="$currentlyPlayingFile"
albumIcon="$(getAlbumIcon)"
title="🎶 $(getCmusInfo 'tag title' '3') 🎶"
artist="🧑‍🎤 $(getCmusInfo 'tag artist' '3')"
album="$(getCmusInfo 'tag album' '3') 💽"
duration="$(getCmusInfo 'duration' '2')"
- playingFile="$currentlyPlayingFile"
fi
[ "$(getCmusInfo 'status' 2)" = 'playing' ] && playingIcon='▶️'
@@ -79,5 +80,5 @@ while [ "$i" -lt "$steps" ]; do
"${artist} - ${album}\n${playingIcon} $(sToTime "${position}") - $(sToTime "${duration}")${bluetoothInfo}"
sleep "$notificationFreq"
- i=$((i+1))
+ #i=$((i+1))
done