scripts/pa.bash

23 lines
574 B
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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 i3s 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%%-*}"