-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvolume
More file actions
executable file
·49 lines (46 loc) · 1.18 KB
/
volume
File metadata and controls
executable file
·49 lines (46 loc) · 1.18 KB
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
45
46
47
48
49
#!/bin/bash
volume_show()
{
msgid=31412
vol=$(amixer get Master | tail -n 1 | awk '{print $3}')
status=$(amixer get Master | tail -n 1 | awk '{print $6}')
icons=('🔇' '🔈' '🔉' '🔊' '🔔')
if [ $status = '[off]' ]; then
icon=${icons[0]}
dunstify -t 1000 -r ${msgid} "$icon Volume $(( $vol*100/87 ))%"
elif [ $vol = '0' ]; then
icon=${icons[0]}
dunstify -u critical -t 1000 -r ${msgid} "$icon Volume $(( $vol*100/87 ))%"
elif [ $vol = '87' ]; then
icon=${icons[4]}
dunstify -u critical -t 1000 -r ${msgid} "$icon Volume $(( $vol*100/87 ))%"
else
icon=${icons[$(( $vol/29 + 1))]}
dunstify -t 1000 -r ${msgid} "$icon Volume $(( $vol*100/87 ))%"
fi
echo $icon $(( $vol*100/87 ))
}
volume_show
# vol=$(amixer get Master | tail -n 1 | awk '{print $3}')
# case $1 in
# '-i') if [ $vol = '87' ]; then
# volume_show $vol
# exit
# fi
# amixer set Master unmute
# amixer set Master $2db+
# volume_show
# ;;
# '-d') if [ $vol = '0' ]; then
# volume_show $vol
# exit
# fi
# amixer set Master unmute
# amixer set Master $2db-
# volume_show
# ;;
# '-t') amixer set Master toggle
# volume_show > ~/testfile
# ;;
# *) volume_show ;;
# esac