Update volume scripts

This commit is contained in:
Santiago Lo Coco 2023-12-08 19:39:58 -03:00
parent 8bba746bca
commit 0f87a8ed80
2 changed files with 18 additions and 6 deletions

View File

@ -8,9 +8,11 @@ ICONspeakermute="🔕"
ICONspeaker="🔔"
ICONheadphone="🎧"
SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
#SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
#SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
SINKANALOG=alsa_output.pci-0000_00_1b.0.analog-stereo
#alsa_output.pci-0000_00_1b.0.analog-surround-51
checkDefaultSink() {
if [ -v LAPTOP ]; then
@ -18,7 +20,7 @@ checkDefaultSink() {
return
fi
PACTLOUTPUT=`pactl info`
PACTLOUTPUT="$(pactl get-default-sink)"
if echo $PACTLOUTPUT | grep -q "$SINKANALOG"; then
SINK=$SINKANALOG

View File

@ -1,11 +1,11 @@
#!/bin/sh
SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
#SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
#SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
SINKANALOG=alsa_output.pci-0000_00_1b.0.analog-stereo
checkDefaultSink() {
PACTLOUTPUT=`pactl info`
PACTLOUTPUT="$(pactl get-default-sink)"
if echo $PACTLOUTPUT | grep -q "$SINKANALOG"; then
SINK=$SINKANALOG
@ -19,8 +19,18 @@ changeDefaultSink() {
if [ "$SINK" = "$SINKANALOG" ]; then
pactl set-default-sink $SINKHDMI
if [ $? -ne 0 ]; then
INDEX="$(pactl list short cards | grep alsa_card.pci-0000_01_00.1 | cut -d$'\t' -f1)"
pactl set-card-profile "$INDEX" output:analog-stereo
pactl set-default-sink $SINKHDMI
fi
elif [ "$SINK" = "$SINKHDMI" ]; then
pactl set-default-sink $SINKANALOG
if [ $? -ne 0 ]; then
INDEX="$(pactl list short cards | grep alsa_card.pci-0000_00_1b.0 | cut -d$'\t' -f1)"
pactl set-card-profile "$INDEX" output:analog-stereo
pactl set-default-sink $SINKANALOG
fi
fi
}