Simplify audio status bar icon

Unify both call and regular mode. Mostly cleanup.
This commit is contained in:
Willow Barraco
2023-12-24 15:28:34 +01:00
parent 5e7e07841f
commit 73416c9280

View File

@@ -371,51 +371,41 @@ set_notifications() {
set_volume() { set_volume() {
VOLCMP="" VOLCMP=""
if sxmo_modemaudio.sh is_call_audio_mode; then
if sxmo_modemaudio.sh is_muted_mic; then
VOLCMP="$icon_mmc"
else
VOLCMP="$icon_mic"
fi
if sxmo_modemaudio.sh is_enabled_speaker; then
VOLCMP="$VOLCMP $icon_spk"
else
VOLCMP="$VOLCMP $icon_ear"
fi
sxmobar -a -f green volume 50 "$VOLCMP"
return;
fi
if sxmo_audio.sh mic ismuted; then if sxmo_audio.sh mic ismuted; then
VOLCMP="$icon_mmc" VOLCMP="$icon_mmc"
else else
VOLCMP="$icon_mic" VOLCMP="$icon_mic"
fi fi
if sxmo_audio.sh vol ismuted; then
VOLCMP="$VOLCMP $icon_mut"
else
case "$(sxmo_audio.sh device get 2>/dev/null)" in case "$(sxmo_audio.sh device get 2>/dev/null)" in
Speaker|"") *Speaker*|"")
# nothing for default or pulse devices # nothing for default or pulse devices
;; ;;
Headphones|Headphone) *Headphone*)
VOLCMP="$VOLCMP $icon_hdp" VOLCMP="$VOLCMP $icon_hdp"
;; ;;
Earpiece) *Earpiece*)
VOLCMP="$VOLCMP $icon_ear" VOLCMP="$VOLCMP $icon_ear"
;; ;;
esac esac
VOL="$(sxmo_audio.sh vol get)" VOL="$(sxmo_audio.sh vol get)"
if [ -z "$VOL" ] || [ "$VOL" = "muted" ]; then if [ "$VOL" -gt 66 ]; then
VOLCMP="$VOLCMP $icon_mut"
elif [ "$VOL" -gt 66 ]; then
VOLCMP="$VOLCMP $icon_spk" VOLCMP="$VOLCMP $icon_spk"
elif [ "$VOL" -gt 33 ]; then elif [ "$VOL" -gt 33 ]; then
VOLCMP="$VOLCMP $icon_spm" VOLCMP="$VOLCMP $icon_spm"
elif [ "$VOL" -ge 0 ]; then elif [ "$VOL" -ge 0 ]; then
VOLCMP="$VOLCMP $icon_spl" VOLCMP="$VOLCMP $icon_spl"
fi fi
fi
if sxmo_modemaudio.sh is_call_audio_mode; then
sxmobar -a -f green volume 50 "$VOLCMP"
else
sxmobar -a volume 50 "$VOLCMP" sxmobar -a volume 50 "$VOLCMP"
fi
} }
sxmo_debug "$@" sxmo_debug "$@"