]> git.phdru.name Git - audio-cdr-video.git/commitdiff
Refactor(audio/pa-volume): Rename volume to set to `NEWVOL`
authorOleg Broytman <phd@phdru.name>
Sun, 30 Mar 2025 22:23:22 +0000 (01:23 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 30 Mar 2025 22:23:22 +0000 (01:23 +0300)
audio/pa-volume

index 56da9a2fe3dfaa11c5cea46ba2bbce7ab1d15d05..bae54c5584e93abeb3ad35b17203ffaf1dc7ba0e 100755 (executable)
@@ -8,11 +8,11 @@ CURVOL=`cat $VOLUME_FILE` # Reads in the current volume
 
 if [[ $1 == "increase" ]]
 then
-   CURVOL=$(($CURVOL + 1310)) #1310 is 2% of the total volume (65535), you can change this to suit your needs.
+   NEWVOL=$(($CURVOL + 1310)) #1310 is 2% of the total volume (65535), you can change this to suit your needs.
 fi
 if [[ $1 == "decrease" ]]
 then
-   CURVOL=$(($CURVOL - 1310))
+   NEWVOL=$(($CURVOL - 1310))
 fi
 if [[ $1 == "mute" ]]
 then
@@ -24,9 +24,9 @@ then
    pactl set-sink-mute "$default_sink" 0
    exit
 fi
-if [[ $CURVOL -ge 0 && $CURVOL -le 65540 ]] # Check to see if the volume is a valid number (65540 was needed in this case because of how I rounded the increment)
+if [[ $NEWVOL -ge 0 && $NEWVOL -le 65540 ]] # Check to see if the volume is a valid number (65540 was needed in this case because of how I rounded the increment)
 then
-   pactl set-sink-volume "$default_sink" $CURVOL
-   echo $CURVOL > $VOLUME_FILE # Write the new volume to disk to be read the next time the script is run.
+   pactl set-sink-volume "$default_sink" $NEWVOL
+   echo $NEWVOL > $VOLUME_FILE # Write the new volume to disk to be read the next time the script is run.
    exit
 fi