diff --git a/.i3blocks/mpd b/.i3blocks/mpd index 1d915d6..00a796e 100755 --- a/.i3blocks/mpd +++ b/.i3blocks/mpd @@ -18,7 +18,8 @@ sed '/^OK/q' <&"$OUT" &>/dev/null # Initialisation des valeurs par défaut et des fonctions declare -i SCROLL=50 I=0 -declare -- artist song oldfile +declare -- artist song +declare -A old human_time() { local seconds="${1}" @@ -107,7 +108,7 @@ do # En cas de changement de morceau, # on réinitialise l’affichage défilant - if [[ "${o["file"]}" != "$oldfile" ]] + if [[ "${o["file"]}" != "${old["file"]}" || "${o["Title"]}" != "${old["Title"]}" || "${o["Name"]}" != "${old["Name"]}" ]] then unset bloc1 bloc2 bloc3 bloc4 artist="${o["Artist"]:-${o["Name"]}}" @@ -126,7 +127,9 @@ do bloc1="$artist" bloc2="$song" - oldfile="${o["file"]}" + old["file"]="${o["file"]}" + old["Title"]="${o["Title"]}" + old["Name"]="${o["Name"]}" I=0 fi