diff options
author | zachir <zachir@librem.one> | 2025-08-30 01:23:23 -0500 |
---|---|---|
committer | zachir <zachir@librem.one> | 2025-08-30 01:23:23 -0500 |
commit | 61c287af21a43a6abf1b8c4e16c82d0673974424 (patch) | |
tree | 48713c48ec592a9d3947d9594c4c9aa018673d52 | |
parent | ad827fb7c4fd6bdd84be8e8882e63735beca33ce (diff) |
Using shellcheck.
-rwxr-xr-x | volsv | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -20,8 +20,8 @@ detect () { up () { case "$AUDIO_SERVER" in WP) wpctl set-volume @DEFAULT_AUDIO_SINK@ "${amt}%+" ;; - SNDIO) sndioctl output.level=+"$(printf "%0.02f" "$(( amt * 0.01 ))")" ;; - PULSE|PW) pactl set-sink-volume $(pactl get-default-sink) "+${amt}%" ;; + SNDIO) sndioctl output.level=+"$(printf "%s" "$amt" | awk '{printf "%0.02f" ($1 * 0.01)}')" ;; + PULSE|PW) pactl set-sink-volume "$(pactl get-default-sink)" "+${amt}%" ;; ALSA) amixer sset Master "${amt}%+" ;; esac } @@ -31,8 +31,8 @@ up () { down () { case "$AUDIO_SERVER" in WP) wpctl set-volume @DEFAULT_AUDIO_SINK@ "${amt}%-" ;; - SNDIO) sndioctl output.level=-"$(printf "%0.02f" "$(( amt * 0.01 ))")" ;; - PULSE|PW) pactl set-sink-volume $(pactl get-default-sink) "-${amt}%" ;; + SNDIO) sndioctl output.level=-"$(printf "%s" "$amt" | awk '{printf "%0.02f" ($1 * 0.01)}')" ;; + PULSE|PW) pactl set-sink-volume "$(pactl get-default-sink)" "-${amt}%" ;; ALSA) amixer sset Master "${amt}%-" ;; esac } @@ -45,7 +45,7 @@ mute () { case "$AUDIO_SERVER" in WP) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; SNDIO) sndioctl output.mute=! ;; - PULSE|PW) pactl set-sink-mute $(pactl get-default-sink) toggle ;; + PULSE|PW) pactl set-sink-mute "$(pactl get-default-sink)" toggle ;; ALSA) amixer sset Master toggle ;; esac ;; @@ -53,7 +53,7 @@ mute () { case "$AUDIO_SERVER" in WP) wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle ;; SNDIO) sndioctl input.mute=! ;; - PULSE|PW) pactl set-source-mute $(pactl get-default-source) toggle ;; + PULSE|PW) pactl set-source-mute "$(pactl get-default-source)" toggle ;; ALSA) amixer sset Capture toggle ;; esac ;; @@ -124,8 +124,8 @@ EOF #{{{ getopts while getopts "hidtmvga" o; do case "${o}" in i) - eval nextopt=\${$OPTIND} - if [ -n "$nextopt" -a "$nextopt" != "-*" ]; then + eval nextopt="\${$OPTIND}" + if [ -n "$nextopt" ] && [ "$nextopt" != "-*" ]; then OPTIND=$((OPTIND + 1)) amt=$nextopt fi @@ -135,8 +135,8 @@ while getopts "hidtmvga" o; do case "${o}" in setact up || exit 1 ;; d) - eval nextopt=\${$OPTIND} - if [ -n "$nextopt" -a "$nextopt" != "-*" ]; then + eval nextopt="\${$OPTIND}" + if [ -n "$nextopt" ] && [ "$nextopt" != "-*" ]; then OPTIND=$((OPTIND + 1)) amt=$nextopt fi |