Browse Source

Made dwm_alsa and dwm_pulse more robust and pretty

main
joestandring 5 years ago
parent
commit
c40b32d729
2 changed files with 19 additions and 19 deletions
  1. +8
    -8
      bar-functions/dwm_alsa.sh
  2. +11
    -11
      bar-functions/dwm_pulse.sh

+ 8
- 8
bar-functions/dwm_alsa.sh View File

@ -10,23 +10,23 @@ dwm_alsa () {
VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/") VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$VOL" -eq 0 ]; then if [ "$VOL" -eq 0 ]; then
printf "[🔇 %s]\n" "$VOL]\n"
printf "[🔇]\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[🔈 %s]\n" "$VOL"
printf "[🔈 %s%%]\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[🔉 %s]\n" "$VOL"
printf "[🔉 %s%%]\n" "$VOL"
else else
printf "[🔊 %s]\n" "$VOL"
printf "[🔊 %s%%]\n" "$VOL"
fi fi
else else
if [ "$VOL" -eq 0 ]; then if [ "$VOL" -eq 0 ]; then
printf "[VOL %s]\n" "$VOL]\n"
printf "[MUTE]\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[VOL %s]\n" "$VOL"
printf "[VOL %s%%]\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[VOL %s]\n" "$VOL"
printf "[VOL %s%%]\n" "$VOL"
else else
printf "[VOL %s]\n" "$VOL"
printf "[VOL %s%%]\n" "$VOL"
fi fi
fi fi
} }


+ 11
- 11
bar-functions/dwm_pulse.sh View File

@ -7,26 +7,26 @@
# Dependencies: pamixer # Dependencies: pamixer
dwm_pulse () { dwm_pulse () {
VOL=$(pamixer --get-volume)
VOL=$(pamixer --get-volume-human | tr -d '%')
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$VOL" -eq 0 ]; then
printf "[🔇 %s]\n" "$VOL]\n"
if [ "$VOL" = "muted" ] || [ "$VOL" -eq 0 ]; then
printf "[🔇]\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[🔈 %s]\n" "$VOL"
printf "[🔈 %s%%]\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[🔉 %s]\n" "$VOL"
printf "[🔉 %s%%]\n" "$VOL"
else else
printf "[🔊 %s]\n" "$VOL"
printf "[🔊 %s%%]\n" "$VOL"
fi fi
else else
if [ "$VOL" -eq 0 ]; then
printf "[VOL %s]\n" "$VOL]\n"
if [ "$VOL" = "muted" ] || [ "$VOL" -eq 0 ]; then
printf "[MUTE]\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[VOL %s]\n" "$VOL"
printf "[VOL %s%%]\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[VOL %s]\n" "$VOL"
printf "[VOL %s%%]\n" "$VOL"
else else
printf "[VOL %s]\n" "$VOL"
printf "[VOL %s%%]\n" "$VOL"
fi fi
fi fi
} }


Loading…
Cancel
Save