summaryrefslogtreecommitdiff
path: root/volume
blob: d00b64341322b11b0240e7285681dea9c64fb3aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
#
# VOLUME
#

id="@DEFAULT_AUDIO_SINK@"
amount="5%"
[ -n "$2" ] && amount="$2"

if [ "$#" -eq 0 ]; then
	wpctl get-volume "$id" | awk '{print$2}'
	exit
fi

case "$1" in
	"toggle"|"mute")
		[ "$2" = "mic" ] && id="@DEFAULT_AUDIO_SOURCE@"
		wpctl set-mute "$id" toggle
		;;
	"up")
		wpctl set-mute "$id" 0
		wpctl set-volume --limit 1.0 "$id" "$amount"+
		;;
	"down")
		wpctl set-mute "$id" 0
		wpctl set-volume "$id" "$amount"-
		;;
	"reset")
		wpctl set-volume "$id" 50%
		;;
	"set")
		wpctl set-volume "$id" "$2"
		;;
esac