Add script to print and switch pulseaudio card profiles
This commit is contained in:
parent
101d3fda67
commit
b858aac706
1 changed files with 22 additions and 0 deletions
22
pa.bash
Executable file
22
pa.bash
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# Detect current profile
|
||||
function profile {
|
||||
CURRENT_PROFILE=$(LC_ALL=C pactl list sinks | grep -i "active port" | cut -d " " -f 3)
|
||||
}
|
||||
|
||||
|
||||
# If either i3’s button is 1 or the first argument is “switch”, switch profile
|
||||
if [[ $BLOCK_BUTTON -eq 1 ]] || [ "$1" == "switch" ] ; then
|
||||
profile
|
||||
if ! [ "$CURRENT_PROFILE" = "iec958-stereo-output" ] ; then
|
||||
pacmd set-card-profile 0 output:iec958-stereo
|
||||
else
|
||||
pacmd set-card-profile 0 output:hdmi-stereo-extra2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Print out current profile
|
||||
profile
|
||||
echo "${CURRENT_PROFILE%%-*}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue