Migrate audio menu logic to appmenu and add indicator for current out device

master
Miles Alan 5 years ago
parent e7032a4f7f
commit 3c1fbd9e8d
  1. 10
      scripts/core/sxmo_appmenu.sh
  2. 9
      scripts/core/sxmo_audiocurrentdevice.sh
  3. 15
      scripts/core/sxmo_audioout.sh

@ -51,10 +51,18 @@ 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 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 Bar Toggle ^ 1 ^ key Alt+b
Rotate ^ 1 ^ sxmo_rotate.sh Rotate ^ 1 ^ sxmo_rotate.sh
Audio Out ^ 0 ^ sxmo_audiooutmenu.sh Audio Out ^ 0 ^ sxmo_appmenu.sh audioout
Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh
")" && WINNAME=Config && return ")" && WINNAME=Config && return
# Audio Out menu
echo $WMCLASS | grep -i "audioout" && CURRENTDEV="$(sxmo_audiocurrentdevice.sh)" && CHOICES="$(echo "
Headphones $([[ "$CURRENTDEV" == "Headphone" ]] && echo "✓") ^ 1 ^ sxmo_audioout.sh Headphones
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
")"
# MPV # MPV
echo $WMCLASS | grep -i "mpv" && CHOICES="$(echo " echo $WMCLASS | grep -i "mpv" && CHOICES="$(echo "
Pause ^ 0 ^ key space Pause ^ 0 ^ key space

@ -0,0 +1,9 @@
#!/usr/bin/env sh
audiodevice() {
amixer sget "Earpiece" | grep -E '\[on\]' > /dev/null && echo Earpiece && return
amixer sget "Headphone" | grep -E '\[on\]' > /dev/null && echo Headphone && return
amixer sget "Line Out" | grep -E '\[on\]' > /dev/null && echo Line Out && return
echo "None"
}
audiodevice

@ -1,12 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
OUTINPUT="$( ARG="$1"
echo "Speaker
Headphones
Earpiece
Close Menu" | dmenu -p "Audio Out" -c -fn "Terminus-30" -l 20
)"
[[ "Close Menu" == "$OUTINPUT" ]] && exit 0
SPEAKER="Line Out" SPEAKER="Line Out"
HEADPHONE="Headphone" HEADPHONE="Headphone"
@ -16,11 +9,11 @@ amixer set "$SPEAKER" mute
amixer set "$HEADPHONE" mute amixer set "$HEADPHONE" mute
amixer set "$EARPIECE" mute amixer set "$EARPIECE" mute
if [[ "$OUTINPUT" = "Speaker" ]]; then if [[ "$ARG" = "Speaker" ]]; then
amixer set "$SPEAKER" unmute amixer set "$SPEAKER" unmute
elif [[ "$OUTINPUT" = "Headphones" ]]; then elif [[ "$ARG" = "Headphones" ]]; then
amixer set "$HEADPHONE" unmute amixer set "$HEADPHONE" unmute
elif [[ "$OUTINPUT" = "Earpiece" ]]; then elif [[ "$ARG" = "Earpiece" ]]; then
amixer set "$EARPIECE" unmute amixer set "$EARPIECE" unmute
fi fi
Loading…
Cancel
Save