2021-02-12 23:20:57 +01:00
|
|
|
#!/usr/bin/env sh
|
2020-05-20 18:34:34 +02:00
|
|
|
|
|
|
|
######################################################################
|
2020-05-23 15:47:21 +02:00
|
|
|
# @author : swytch
|
|
|
|
# @file : audio_notify
|
2020-06-25 18:19:40 +02:00
|
|
|
# @license : MIT
|
2020-05-23 15:47:21 +02:00
|
|
|
# @created : Wednesday May 20, 2020 17:52:58 CEST
|
2020-05-20 18:34:34 +02:00
|
|
|
#
|
2020-05-23 15:47:21 +02:00
|
|
|
# @description : send a notification with sound level
|
2020-05-20 18:34:34 +02:00
|
|
|
######################################################################
|
|
|
|
|
2020-05-06 03:20:19 +02:00
|
|
|
|
2020-09-12 19:12:32 +02:00
|
|
|
level="$(amixer sget Master | awk -F "[][]" ' { printf "%s", $2 }' | awk -F "%" '{printf $1}')"
|
|
|
|
muted="$(amixer sget Master | awk -F "[][]" '/%/ { printf "%4s", $4 }' | awk '{printf $1}')"
|
2020-05-06 03:20:19 +02:00
|
|
|
|
2020-09-12 19:12:32 +02:00
|
|
|
if [ "$muted" = "off" ]; then
|
2020-05-06 03:20:19 +02:00
|
|
|
dunstify -r 100002 "Sound muted" "$level%"
|
|
|
|
else
|
|
|
|
case "$level" in
|
2020-06-14 16:41:18 +02:00
|
|
|
[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]) criticity="low" ;;
|
|
|
|
6[0-9]|7[0-9]) criticity="normal" ;;
|
|
|
|
8[0-9]|9[0-9]|10[0-9]) criticity="critical" ;;
|
2020-05-06 03:20:19 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
dunstify -r 100002 -u "$criticity" "Current pamixer value :" "$level%"
|
|
|
|
fi
|