2024-01-09 18:49:10 +01:00

22 lines
758 B
Bash

#!/usr/bin/env bash
function main() {
DEFAULT_SOURCE=$(pw-record --list-targets | sed -n 's/^*[[:space:]]*[[:digit:]]\+: description="\(.*\)" prio=[[:digit:]]\+$/\1/p')
DEFAULT_SINK_ID=$(pw-play --list-targets | sed -n 's/^*[[:space:]]*\([[:digit:]]\+\):.*$/\1/p')
DEFAULT_SINK=$(pw-play --list-targets | sed -n 's/^*[[:space:]]*[[:digit:]]\+: description="\(.*\)" prio=[[:digit:]]\+$/\1/p')
VOLUME=$(pamixer --get-volume-human)
action=$1
if [ "${action}" == "up" ]; then
pamixer --increase 10
elif [ "${action}" == "down" ]; then
pamixer --decrease 10
elif [ "${action}" == "mute" ]; then
pamixer --toggle-mute
else
echo "${DEFAULT_SOURCE} ${VOLUME} ${DEFAULT_SINK}"
fi
}
main "$@"