diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 62f948d..ef98a5c 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.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 Bar Toggle ^ 1 ^ key Alt+b 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 ")" && 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 echo $WMCLASS | grep -i "mpv" && CHOICES="$(echo " Pause ^ 0 ^ key space diff --git a/scripts/core/sxmo_audiocurrentdevice.sh b/scripts/core/sxmo_audiocurrentdevice.sh new file mode 100755 index 0000000..9dda063 --- /dev/null +++ b/scripts/core/sxmo_audiocurrentdevice.sh @@ -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 diff --git a/scripts/core/sxmo_audiooutmenu.sh b/scripts/core/sxmo_audioout.sh similarity index 50% rename from scripts/core/sxmo_audiooutmenu.sh rename to scripts/core/sxmo_audioout.sh index 39d7edf..5eeb307 100755 --- a/scripts/core/sxmo_audiooutmenu.sh +++ b/scripts/core/sxmo_audioout.sh @@ -1,12 +1,5 @@ #!/usr/bin/env sh -OUTINPUT="$( -echo "Speaker -Headphones -Earpiece -Close Menu" | dmenu -p "Audio Out" -c -fn "Terminus-30" -l 20 -)" - -[[ "Close Menu" == "$OUTINPUT" ]] && exit 0 +ARG="$1" SPEAKER="Line Out" HEADPHONE="Headphone" @@ -16,11 +9,11 @@ amixer set "$SPEAKER" mute amixer set "$HEADPHONE" mute amixer set "$EARPIECE" mute -if [[ "$OUTINPUT" = "Speaker" ]]; then +if [[ "$ARG" = "Speaker" ]]; then amixer set "$SPEAKER" unmute -elif [[ "$OUTINPUT" = "Headphones" ]]; then +elif [[ "$ARG" = "Headphones" ]]; then amixer set "$HEADPHONE" unmute -elif [[ "$OUTINPUT" = "Earpiece" ]]; then +elif [[ "$ARG" = "Earpiece" ]]; then amixer set "$EARPIECE" unmute fi