-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamx_set-volume
36 lines (32 loc) · 1.06 KB
/
amx_set-volume
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
# ====================================================
# AMX_Manager Copyright(C) 2018 Furkan Türkal
# This program comes with ABSOLUTELY NO WARRANTY; This is free software,
# and you are welcome to redistribute it under certain conditions; See
# file LICENSE, which is part of this source code package, for details.
# ====================================================
#!/bin/sh
change_volume() {
killall dunst
amixer -D pulse set Master "$1"
notify-send -a 'AMX_Volume' -t 1000 -i notification-audio-volume-medium `amixer -D pulse get Master|tail -n1|sed -E 's/.*\[([0-9]+)\%\].*/\1/'`
}
main() {
case "$1" in
up)
change_volume 5%+
;;
down)
change_volume 5%-
;;
toggle)
amixer -D pulse set Master 1+ toggle
notify-send -a 'AMX_Volume' -t 1000 -i notification-audio-volume-medium `amixer -D pulse get Master | tail -n1 | sed -E 's/.*\[([a-z]+)].*/\1/'`
;;
*)
printf "volume <command>\n"
printf " up \n"
printf " down\n"
printf " toggle\n"
esac
}
main "$@"