From e11af581e6804318be870538e73fa85dcdf54f1a Mon Sep 17 00:00:00 2001 From: AngeD Date: Mon, 17 Oct 2022 23:16:04 +0200 Subject: [PATCH] feat: optimized set-vol --- bin/set-vol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/set-vol b/bin/set-vol index 605647f..a1babcf 100755 --- a/bin/set-vol +++ b/bin/set-vol @@ -1,6 +1,8 @@ #!/bin/bash set -e +# TODO: multiple fast invocation cause volume not to be updated + PACTL_SINK='@DEFAULT_SINK@' SINK="$PACTL_SINK" @@ -21,9 +23,7 @@ set +e get_vol set -e -VOL="$(echo "$VOL" | grep -o -E '[0-9]{,3}%' | head -n 1)" -# Remove everything after first '%' -VOL="${VOL%%%*}" +VOL="$(echo "$VOL" | grep -Po '\d+(?=%)' | head -n 1)" VOL="$((VOL - VOL % "$1"))" case "${1:0:1}" in