[Emacs] Always use selected sink

This commit is contained in:
Ivan Malison 2016-12-29 20:44:32 -08:00
parent e84d7f9b98
commit fd57bc0a61
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 6 additions and 2 deletions

View File

@ -2,4 +2,4 @@
pulseaudio-ctl "$@"
notify-send " " -i notification-audio-volume-high -h int:value:$(SINK=1 pavolume) -h string:synchronous:volume
notify-send " " -i notification-audio-volume-high -h int:value:$(pavolume) -h string:synchronous:volume

View File

@ -1,6 +1,10 @@
command_exists 'open' || command_exists 'xdg-open' && alias open='xdg-open'
pasink () {
pacmd list-sinks | grep '* index' | get_cols ' -1'
}
pavolume () {
pactl list sinks | grep '^[[:space:]]Volume:' | \
head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,'
head -n $(( $(pasink) + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,'
}