Tidy up bin folder

This commit is contained in:
Jonathan Hodgson 2020-01-31 14:52:49 +00:00
parent 93e4d3d087
commit fc348e7ddf
18 changed files with 1395 additions and 948 deletions

View file

@ -3,6 +3,25 @@
# A simple script to adjust the volume
# Requires pulse and amixer
function drawBar(){
local percent=$1;
for i in {1..10}; do
local boxPercent=$(($i*10))
if [ "$boxPercent" -lt "$percent" ]; then
echo -n "■"
elif [ "$boxPercent" -eq "$percent" ]; then
echo -n "■"
elif [ "$(($boxPercent-10))" -lt "$percent" ]; then
echo -n "▣"
else
echo -n "□"
fi
done
}
case "$1" in
"up")
amixer -q -D default sset Master 5%+ unmute
@ -14,4 +33,13 @@ case "$1" in
amixer -q -D default sset Master toggle
esac
command -v notify-send && notify-send "Volume" "$(amixer -D default sget Master | grep -o '\[.*\%' | head -n 1 | tr -d '[')"
volume="$(amixer -D default sget Master | grep -o '\[.*\%' | head -n 1 | tr -d '[%')"
speakerStatus="$(amixer -D default sget Master | grep -o '\[\(on\|off\)' | head -n 1 | tr -d '[')"
echo "$speakerStatus"
if [[ "$speakerStatus" == "on" ]]; then
command -v notify-send && notify-send -R "/tmp/volume" "Volume" "$(drawBar $volume) ${volume}%"
else
command -v notify-send && notify-send -R "/tmp/volume" "Volume" "Muted"
fi