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
2017-04-22 21:54:49 -06:00

32 lines
721 B
Bash
Executable File

#!/bin/bash
# script for changing the volume and sending
# notification to twmn using twmnc
step=1
sink="@DEFAULT_SINK@"
if [[ $# -eq 1 ]]; then
case $1 in
"up")
pactl set-sink-mute $sink false
pactl set-sink-volume $sink +$step%
direction='increased to ';;
"down")
pactl set-sink-volume $sink -$step%
direction='decreased to ';;
"mute")
pactl set-sink-mute $sink toggle;;
*)
echo "Invalid option";;
esac
fi
muted=`pactl list sinks | grep "Mute" | awk '{print $2}'`
vol=`pactl list sinks | grep "front-left" | awk '{print $5}'`
if [[ $muted == "no" ]]; then
twmnc -t 'volume' -c 'muted' -d 100
else
twmnc -t 'volume' -c "${direction}${vol}" -d 100
fi