diff options
author | Adam <56338480+adastx@users.noreply.github.com> | 2021-09-06 15:29:47 +0200 |
---|---|---|
committer | Adam <56338480+adastx@users.noreply.github.com> | 2021-09-06 15:29:47 +0200 |
commit | 9eacd86fa20aeec3f044ca7581a7f1d61e17e629 (patch) | |
tree | 11c3b70e54f19cf9b11f13576b356bca577907d9 /.config/i3/custom | |
parent | 693951da184413f73c62365e113102b788a13511 (diff) |
Capped volume at 100%
Diffstat (limited to '.config/i3/custom')
-rwxr-xr-x | .config/i3/custom/volume_up.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.config/i3/custom/volume_up.sh b/.config/i3/custom/volume_up.sh new file mode 100755 index 0000000..c03d0ef --- /dev/null +++ b/.config/i3/custom/volume_up.sh @@ -0,0 +1,10 @@ +#!/bin/bash +max_volume_pc=$1 +current_volume_pc=$(pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') +if (($current_volume_pc < $max_volume_pc-5)) ; then + pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status +else + a=$(($max_volume_pc - $current_volume_pc)) + pactl set-sink-volume @DEFAULT_SINK@ +$a% && $refresh_i3status +fi + |