This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.local/bin/audio-notify

29 lines
784 B
Plaintext
Raw Normal View History

#!/usr/bin/env sh
######################################################################
2021-02-14 19:07:45 +01:00
# @author : swytch
# @file : audio_notify
# @license : GPLv3
2021-02-14 19:07:45 +01:00
# @created : Wednesday May 20, 2020 17:52:58 CEST
#
2021-02-14 19:07:45 +01:00
# @description : send a notification with sound level
######################################################################
2020-05-06 03:20:19 +02:00
level="$(pulsemixer --get-volume | awk -F " " '{ printf "%d", $1 }')"
muted="$(pulsemixer --get-mute)"
2020-05-06 03:20:19 +02:00
if [ "1" = "$muted" ]; then
2020-05-06 03:20:19 +02:00
dunstify -r 100002 "Sound muted" "$level%"
else
case "$level" in
[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" ;;
*) criticity="critical" ;;
2020-05-06 03:20:19 +02:00
esac
dunstify -r 100002 -u "$criticity" "Current volume :" "$level%"
2020-05-06 03:20:19 +02:00
fi
kill -38 $(pidof dwmblocks)