From a4562f2dd4025766f04f1a34a93da0fad5c9113f Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Tue, 26 May 2020 18:21:48 -0500 Subject: [PATCH] Update to show different letter depending on audio out device --- scripts/core/sxmo_appmenu.sh | 4 ++-- scripts/core/sxmo_statusbar.sh | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index ef98a5c..c816769 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -15,6 +15,7 @@ programchoicesinit() { Texts ^ 0 ^ sxmo_modemtext.sh Camera ^ 0 ^ sxmo_camera.sh Wifi ^ 0 ^ st -e "nmtui" + Audio ^ 0 ^ sxmo_appmenu.sh audioout Config ^ 0 ^ sxmo_appmenu.sh config Logout ^ 0 ^ pkill -9 dwm ")" && WINNAME=Sys @@ -51,7 +52,6 @@ programchoicesinit() { Flash $(cat /sys/class/leds/white:flash/brightness | grep -E '^0$' > /dev/null && echo -n "Off → On" || echo -n "On → Off") ^ 1 ^ sxmo_flashtoggle.sh Bar Toggle ^ 1 ^ key Alt+b Rotate ^ 1 ^ sxmo_rotate.sh - Audio Out ^ 0 ^ sxmo_appmenu.sh audioout Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh ")" && WINNAME=Config && return @@ -61,7 +61,7 @@ programchoicesinit() { Speaker $([[ "$CURRENTDEV" == "Line Out" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Speaker Earpiece $([[ "$CURRENTDEV" == "Earpiece" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Earpiece None $([[ "$CURRENTDEV" == "None" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh None - ")" + ")" && WINNAME="Audio" && return # MPV echo $WMCLASS | grep -i "mpv" && CHOICES="$(echo " diff --git a/scripts/core/sxmo_statusbar.sh b/scripts/core/sxmo_statusbar.sh index 1e75979..a95fda0 100755 --- a/scripts/core/sxmo_statusbar.sh +++ b/scripts/core/sxmo_statusbar.sh @@ -25,18 +25,19 @@ do ) # Volume - VOL=$( - echo "$(amixer sget "$(audiodevice)")" | + AUDIODEV="$(sxmo_audiocurrentdevice.sh)" + [[ $AUDIODEV == "None" ]] && VOL="" || VOL=$(echo "$AUDIODEV" | cut -c1 | tr L S)"$( + amixer sget "$AUDIODEV" | grep -oE '([0-9]+)%' | tr -d ' %' | awk '{ s += $1; c++ } END { print s/c }' | xargs printf %.0f - ) + )" # Time TIME=$(date +%R) - BAR=" ${MODEMMON}V${VOL} ${BATSTATUS}${PCT}% ${TIME}" + BAR=" ${MODEMMON}${VOL} ${BATSTATUS}${PCT}% ${TIME}" xsetroot -name "$BAR" inotifywait -e MODIFY $UPDATEFILE & sleep 30 & wait -n