dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit 842539079df6ece7b272f2b9fa443c159aba74e5
parent 4c7d66890844e88c8f636dbf2893f3b7a77f13b6
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Thu, 20 May 2021 19:19:35 -0400

Fix bug when no music playing in status script

Diffstat:
M.local/bin/status | 54++++++++++++++++++++++++++----------------------------
1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/.local/bin/status b/.local/bin/status @@ -26,35 +26,33 @@ while true; do curStatus=$(echo "$nowPlaying" | head -1 | cut -d' ' -f2) if [ "$curStatus" != "playing" ] && [ "$curStatus" != "paused" ]; then - printf "Nothing Playing" - exit 0 + nowPlaying="Nothing Playing" + else + # Truncate long title (e.g. "Burned Down Cigarettes" -> "Burned Down C...") + # if [ "$(echo "$title" | wc -m)" -gt 16 ]; then + # title=$( printf "%.16s" "$title" | sed 's/...$/.../') + # fi + # Truncate long artist name (e.g. "Midnight Ambassador" -> "Midnight Am.") + # if [ "$(echo "$artist" | wc -m)" -gt 12 ]; then + # artist=$( printf "%.12s" "$artist" | sed 's/.$/./') + # fi + + durationMinutes=$((duration/60)) + durationSeconds=$((duration%60)) + positionMinutes=$((position/60)) + positionSeconds=$((position%60)) + + if [ "$shuffle" = "true" ]; then + icons="$icons " + fi + if [ "$repeat" = "true" ]; then + icons="$icons " + fi + + nowPlaying=$(printf "\"%s\" by %s — %02d:%02d/%02d:%02d%s" \ + "$title" "$artist" "$positionMinutes" "$positionSeconds" \ + "$durationMinutes" "$durationSeconds" "$icons") fi - - # Truncate long title (e.g. "Burned Down Cigarettes" -> "Burned Down C...") - # if [ "$(echo "$title" | wc -m)" -gt 16 ]; then - # title=$( printf "%.16s" "$title" | sed 's/...$/.../') - # fi - - # Truncate long artist name (e.g. "Midnight Ambassador" -> "Midnight Am.") - # if [ "$(echo "$artist" | wc -m)" -gt 12 ]; then - # artist=$( printf "%.12s" "$artist" | sed 's/.$/./') - # fi - - durationMinutes=$((duration/60)) - durationSeconds=$((duration%60)) - positionMinutes=$((position/60)) - positionSeconds=$((position%60)) - - if [ "$shuffle" = "true" ]; then - icons="$icons " - fi - if [ "$repeat" = "true" ]; then - icons="$icons " - fi - - nowPlaying=$(printf "\"%s\" by %s — %02d:%02d/%02d:%02d%s" \ - "$title" "$artist" "$positionMinutes" "$positionSeconds" \ - "$durationMinutes" "$durationSeconds" "$icons") # End NowPlaying Section xsetroot -name "$nowPlaying;$cpuTemp°C $cpuUtil% $memUtil $diskUtil $localTime/$europeTime"