#!/bin/sh vol=${BEEP_VOL:-0.5} snd=${BEEP_SND:-$HOME/Music/sounds/miui/} subject=${BEEP_SUB:-Beep} message=${BEEP_MSG:-"The bell rang"} icon=${BEEP_ICN:-"$(iconez -p $PPID | head -n1)"} nobel= nonotify= while getopts v:s:S:M:i:bNh opt; do case "$opt" in v) vol=${OPTARG} ;; s) snd=${OPTARG} ;; # S) subject=${OPTARG} ;; # M) message=${OPTARG} ;; # i) icon=${OPTARG} ;; N) nonotify=1 ;; b) nobel=1 ;; h | ?) printf "usage: %s [-h] -- NOTIFY_SEND_ARGS\n" "$(basename "$0")" printf "\n" printf " -v \t volume (default: ${vol})\n" printf " -s \t sound file (default: ${snd})\n" printf " -b \t don't sound terminal bell (default: false)\n" printf " -N \t don't send notification (default: false)\n" printf "\n" exit 2 ;; esac done shift $((OPTIND - 1)) ( echo ${PPID} [ -z "${nobel}" ] && tput bel & if [ -z "${nonotify}" ]; then if [ -z "$*" ]; then notify-send -a beep -u normal -i "${icon}" "${subject}" "${message}" & else notify-send -a beep -u normal -i "${icon}" "$@" & fi fi if [ ! -f "${snd}" ]; then case "${1}" in done) snd=${snd}/complete.ogg ;; *) snd=${snd}/bell.ogg ;; esac fi paplay \ --property=media.role=event \ --volume="${vol}" \ "${snd}" ) &