From 9eacd86fa20aeec3f044ca7581a7f1d61e17e629 Mon Sep 17 00:00:00 2001 From: Adam <56338480+adastx@users.noreply.github.com> Date: Mon, 6 Sep 2021 15:29:47 +0200 Subject: Capped volume at 100% --- .config/i3/config | 2 +- .config/i3/custom/volume_up.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 .config/i3/custom/volume_up.sh (limited to '.config') diff --git a/.config/i3/config b/.config/i3/config index 8ae9bb2..7aeba1e 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -25,7 +25,7 @@ bindsym $alt+b exec --no-startup-id rofi -modi "clipboard:greenclip print" -show bindsym $mod+p exec --no-startup-id rofi-pass # Media keys -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% +bindsym XF86AudioRaiseVolume exec --no-startup-id ~/.config/i3/custom/volume_up.sh 100 bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause 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 + -- cgit v1.2.3-70-g09d2