Created
April 4, 2019 13:49
-
-
Save shrdlu68/1e7ecff6784c39c61d3cf24ba3a88fcb to your computer and use it in GitHub Desktop.
Control volume of active PulseAudio audio sink
This file contains 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 | |
function get_active_sink () | |
{ | |
input=$(pactl list short sinks | awk '$7=="RUNNING" {print $2}') | |
echo -n "$input" | |
} | |
function mute_toggle () | |
{ | |
pactl set-sink-mute "$1" toggle | |
} | |
function volume_incf () | |
{ | |
pactl set-sink-volume "$1" +2% | |
} | |
function volume_decf () | |
{ | |
pactl set-sink-volume "$1" -2% | |
} | |
sink=$(get_active_sink) | |
case "$1" in | |
toggle) | |
mute_toggle "$sink" | |
;; | |
incf) | |
volume_incf "$sink" | |
;; | |
decf) | |
volume_decf "$sink" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment