aboutsummaryrefslogtreecommitdiff
path: root/cmusShow.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2024-02-19 14:32:12 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2024-02-19 14:32:12 +0100
commit039a79d51b37f1f0f9dd125ba324e292bb3d32c7 (patch)
treefa9baac0119db52541948afc0aae10678989b50d /cmusShow.sh
parentdf55f83d1394842559abfa3ebb883dc4ce99975b (diff)
downloadscripts-039a79d51b37f1f0f9dd125ba324e292bb3d32c7.tar.gz
scripts-039a79d51b37f1f0f9dd125ba324e292bb3d32c7.zip
Made cmusShow.sh permanent and added more window sizes to setWindowSize.sh
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