From 039a79d51b37f1f0f9dd125ba324e292bb3d32c7 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Mon, 19 Feb 2024 14:32:12 +0100 Subject: Made cmusShow.sh permanent and added more window sizes to setWindowSize.sh --- cmusShow.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cmusShow.sh') 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 -- cgit v1.2.1