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,' }