-
Notifications
You must be signed in to change notification settings - Fork 1
/
deaf.tool
executable file
·44 lines (39 loc) · 918 Bytes
/
deaf.tool
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
36
37
38
39
40
41
42
43
44
#!/bin/bash
# volume changer
get_percent(){
mute_status="$(pactl get-sink-mute @DEFAULT_SINK@)"
if [[ "$mute_status" =~ yes$ ]]; then
echo "MUTE"
else
percent="$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Eo "[0-9]+%" | head -n1)"
echo "${percent}%"
fi
}
case "$1" in
+|UP)
pactl set-sink-volume @DEFAULT_SINK@ +5%
;;
-|DOWN)
pactl set-sink-volume @DEFAULT_SINK@ -5%
;;
mute|LEFT)
pactl set-sink-mute @DEFAULT_SINK@ toggle
;;
mic*)
pactl set-source-mute @DEFAULT_SOURCE@ toggle
;;
--subscribe)
get_percent
pactl subscribe | grep --line-buffered "sink" |
while read -r; do
get_percent
done
;;
--info)
get_percent
;;
*)
echo "SYNOPSIS: deaf [+|-|mute|mic|--subscribe|--info]"
exit
;;
esac