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
David JULIEN 95713ba7fd rename: underscore -> hyphen
arch_setup -> arch-setup
audio_notify -> audio-notify
update README in consequence
2021-02-16 00:34:53 +01:00

29 lines
787 B
Bash
Executable File

#!/usr/bin/env sh
######################################################################
# @author : swytch
# @file : audio_notify
# @license : MIT
# @created : Wednesday May 20, 2020 17:52:58 CEST
#
# @description : send a notification with sound level
######################################################################
level="$(pulsemixer --get-volume | awk -F " " '{ printf "%d", $1 }')"
muted="$(pulsemixer --get-mute)"
if [ "1" = "$muted" ]; then
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" ;;
esac
dunstify -r 100002 -u "$criticity" "Current volume :" "$level%"
fi
kill -38 $(pidof dwmblocks)