This repository has been archived on 2026-01-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
dotfiles-old/volumeset.sh
T

30 lines
659 B
Bash
Executable File

#!/bin/bash
# script for changing the volume and sending
# notification to twmn using twmnc
step=1
if [[ $# -eq 1 ]]; then
case $1 in
"up")
amixer set Master $step%+
direction='increased to ';;
"down")
amixer set Master $step%-
direction='decreased to ';;
"mute")
amixer set Master toggle;;
*)
echo "Invalid option";;
esac
fi
muted=`amixer get Master | grep "Front Left:" | awk '{print $6}'`
vol=`amixer get Master | grep "Front Left:" | awk '{print $5}' | tr -d '[]'`
if [[ $muted == "[off]" ]]; then
twmnc -t 'volume' -c 'muted' -d 100
else
twmnc -t 'volume' -c "${direction}${vol}" -d 100
fi