Skip to content

Instantly share code, notes, and snippets.

@danclien
Created April 21, 2017 16:03
Show Gist options
  • Save danclien/21e01b5c91726fc0326524762f2c1b42 to your computer and use it in GitHub Desktop.
Save danclien/21e01b5c91726fc0326524762f2c1b42 to your computer and use it in GitHub Desktop.
#!/bin/bash
SINK_INDEX=$(pacmd list-sinks | grep index | sed -e 's/^.* //')
if [[ $1 == "internal" ]]; then
pactl set-card-profile 0 output:analog-stereo+input:analog-stereo
elif [[ $1 == "hdmi" ]]; then
pactl set-card-profile 0 output:hdmi-stereo-extra1+input:analog-stereo
elif [[ $1 == "down" ]]; then
echo "Volume down 5%"
pactl set-sink-volume "$SINK_INDEX" -5% # > /dev/null 2>&1
elif [[ $1 == "up" ]]; then
echo "Volume up 5%"
pactl set-sink-volume "$SINK_INDEX" +5% # > /dev/null 2>&1
elif [[ $1 == "mute" ]]; then
echo "Volume mute"
pactl set-sink-mute "$SINK_INDEX" toggle # > /dev/null 2>&1
fi
# Update i3blocks volume control
pkill -RTMIN+10 i3blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment