From fd57bc0a61c369a8ef0636d1e3618e2f0641b8f2 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 29 Dec 2016 20:44:32 -0800 Subject: [PATCH] [Emacs] Always use selected sink --- dotfiles/lib/bin/set_volume.sh | 2 +- dotfiles/lib/shellenv/linux.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dotfiles/lib/bin/set_volume.sh b/dotfiles/lib/bin/set_volume.sh index 508be3e3..86fc937d 100755 --- a/dotfiles/lib/bin/set_volume.sh +++ b/dotfiles/lib/bin/set_volume.sh @@ -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 diff --git a/dotfiles/lib/shellenv/linux.sh b/dotfiles/lib/shellenv/linux.sh index 650bda86..84d9a0fe 100644 --- a/dotfiles/lib/shellenv/linux.sh +++ b/dotfiles/lib/shellenv/linux.sh @@ -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,' }