Created
September 7, 2015 23:10
-
-
Save gitfer/221ca46d38b6cca290fd to your computer and use it in GitHub Desktop.
Swith between hdmi and analog speakers tuning volumes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURRENT_PROFILE=$(pacmd list-cards | grep "active profile" | cut -d ' ' -f 3-) | |
if [ "$CURRENT_PROFILE" = "<output:hdmi-stereo+input:analog-stereo>" ] ; then | |
# Imposto analog speaker | |
pacmd set-card-profile 0 "output:analog-stereo+input:analog-stereo" | |
pacmd set-sink-port "alsa_output.pci-0000_00_08.0.analog-stereo" analog-output-speaker | |
pacmd set-source-volume alsa_input.pci-0000_00_08.0.analog-stereo 5 | |
# regolo il volume | |
pactl set-sink-volume alsa_output.pci-0000_00_08.0.analog-stereo 100% | |
else | |
# In HDMI rendo muti gli speaker | |
pacmd set-sink-volume alsa_output.pci-0000_00_08.0.analog-stereo 0 | |
# Setto hdmi | |
pacmd set-card-profile 0 "output:hdmi-stereo+input:analog-stereo" | |
pacmd set-sink-port "alsa_output.pci-0000_00_08.0.hdmi-stereo" hdmi-output-0 | |
fi | |
pacmd list-cards | grep "active profile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment