mirror of
https://github.com/Keyitdev/dotfiles.git
synced 2026-09-24 01:52:09 +00:00
Major Update: created v4, new configs: alacritty, polybar, i3, and more.
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# default
|
||||
step=+5
|
||||
vol_max=125
|
||||
|
||||
cur_vol_left=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | sed -n '1p'| sed 's/%//g')
|
||||
cur_vol_right=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | sed -n '2p' | sed 's/%//g')
|
||||
cur_vol_average=$(((cur_vol_left+cur_vol_right)/2))
|
||||
|
||||
while getopts s:m: flag
|
||||
do
|
||||
case "${flag}" in
|
||||
s) step=${OPTARG};;
|
||||
m) vol_max=${OPTARG};;
|
||||
*) echo "Usage: -s <+value/-value> -m <max volume>";;
|
||||
esac
|
||||
done
|
||||
|
||||
new_vol=$((cur_vol_average + step))
|
||||
|
||||
if [ "$new_vol" -le "0" ]; then
|
||||
pactl set-sink-volume @DEFAULT_SINK@ 0%
|
||||
elif [ "$new_vol" -ge "$vol_max" ] ; then
|
||||
pactl set-sink-volume @DEFAULT_SINK@ "$vol_max"%
|
||||
else
|
||||
pactl set-sink-volume @DEFAULT_SINK@ "$step"%
|
||||
fi
|
||||
Reference in New Issue
Block a user