Skip to content

Instantly share code, notes, and snippets.

@abdumu
Created July 2, 2020 22:09
Show Gist options
  • Save abdumu/6b49dacf20e4cb34f0878a7f834fd7bc to your computer and use it in GitHub Desktop.
Save abdumu/6b49dacf20e4cb34f0878a7f834fd7bc to your computer and use it in GitHub Desktop.
Increase Linux audio volume to above 100% (160%) to match Windows volume boost.
#!/bin/bash
volume=$(pacmd list-sinks|grep -A 15 '* index'| awk '/volume: front/{ print $5 }' | sed 's/[%|,]//g')
command=$1;
percentage=$(( 160*20/100 ))
if [ "$command" = "" ]; then
command="up"
fi
if [ "$command" = "up" ]; then
if [ "$volume" -gt "160" ]; then
exit
fi
current_volume=$(($volume+$percentage))
pactl set-sink-volume 0 +20%
fi
if [ "$command" = "down" ]; then
if [ "$volume" = "0" ]; then
exit
fi
current_volume=$(($volume-$percentage))
pactl set-sink-volume 0 -20%
fi
if [ "$current_volume" -gt "160" ]; then
current_volume=160
fi
if [ "$current_volume" -lt "0" ]; then
current_volume=0
fi
if [ "$icon_name" = "" ]; then
if [ "$current_volume" = "0" ]; then
icon_name="notification-audio-volume-off"
else
if [ "$current_volume" -lt "33" ]; then
icon_name="notification-audio-volume-low"
else
if [ "$current_volume" -lt "80" ]; then
icon_name="notification-audio-volume-medium"
else
icon_name="notification-audio-volume-high"
fi
fi
fi
fi
notify-send "Volume to "$current_volume"/160" -i $icon_name -h int:value:$current_volume -h string:synchronous:volume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment