notify-send (1175B)
1 #!/bin/sh 2 usage(){ 3 cat <<EOF 4 usage: ${0##*/} [OPTION...] <SUMMARY> [BODY] 5 6 POSIX sh replacement for notify-send(1) on dwm(1) 7 8 Options: 9 10 -t, --expire-time=TIME 11 -a, --app-name=APP_NAME 12 13 Options that exist for compatibility (but are ignored): 14 15 -u, --urgency=LEVEL 16 -i, --icon=ICON 17 18 You can change the delimiter ('-' by default) from your environment 19 by adding a NOTIFY_SEND_DELIMITER variable. This way you can also 20 make use of the two bar patches on dwm. 21 22 EOF 23 exit 1 24 } 25 O="$(getopt -q -l app-name:,urgency:,expire-time:,icon: -- a:u:t:i:: "$@")" || usage 26 eval set -- "$O" 27 while :; do 28 case "$1" in 29 -a|--app-name) APPNAME="$2" ; shift 2 ;; 30 -t|--expire-time) TIME="$2"; shift 2 ;; 31 -u|--urgency) _="$2"; shift 2 ;; 32 -i|--icon) _="$2"; shift 2 ;; 33 --) shift; break ;; 34 *) printf '%s is not supported\n' "$1" ; exit 1 ;; 35 esac 36 done 37 [ "$1" ] || usage 38 [ "$APPNAME" ] && APPNAME="$APPNAME:" 39 NOTIFY_SEND_DELIMITER="${NOTIFY_SEND_DELIMITER--}" 40 [ "$2" ] && SUMMARY="$1 $NOTIFY_SEND_DELIMITER" 41 TIME=${TIME-3} 42 timeout "$TIME" sh -c "printf \"\$\$\" > /tmp/notify-$(id -u) ; while :; do xsetroot -name ' $APPNAME ${SUMMARY-$1} $2 ' ; done" &