4 SCRIPTNAME
=termux-notification
6 echo "Usage: termux-notification [-c content] [-i id] [-t title] [-u url]"
7 echo "Display a system notification."
9 echo " -c,--content content notification content to show"
10 echo " -i id notification id (will overwrite any previous notification with the same id)"
11 echo " --led-color color of the blinking led as RRGGBB (default: none)"
12 echo " --led-on number of milliseconds for the LED to be on while it's flashing (default: 800)"
13 echo " --led-off number of milliseconds for the LED to be off while it's flashing (default: 800)"
14 echo " --priority notification priority (high/low/max/min/default)"
15 echo " --sound play a sound with the notification"
16 echo " -t,--title title notification title to show"
17 echo " -u url notification url when clicking on it"
18 echo " --vibrate pattern vibrate pattern, comma separated as in 500,1000,200"
23 CONTENT_OR_TITLE_SET
=no
38 TEMP
=`busybox getopt \
41 --long content:,help,id:,led-color:,led-on:,led-off:,priority:,sound,vibrate: \
48 -c |
--content
) ARG_C
="--es content"; OPT_C
="$2"; CONTENT_OR_TITLE_SET
=yes; shift 2;;
49 -h |
--help) show_usage
;;
50 -i |
--id
) OPT_ID
="$2"; shift 2;;
51 --led-color
) OPT_LED_COLOR
="$2"; shift 2;;
52 --led-on
) OPT_LED_ON
="$2"; shift 2;;
53 --led-off
) OPT_LED_OFF
="$2"; shift 2;;
54 --priority
) OPT_PRIORITY
="$2"; shift 2;;
55 --sound
) OPT_SOUND
="true"; shift 1;;
56 -t |
--title
) ARG_T
="--es title"; OPT_T
="$2"; CONTENT_OR_TITLE_SET
=yes; shift 2;;
57 -u
) ARG_U
="--es url"; OPT_U
="$2"; shift 2;;
58 --vibrate
) OPT_VIBRATE
="$2"; shift 2;;
63 if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
65 if [ $CONTENT_OR_TITLE_SET = "no" ]; then
66 echo "$SCRIPTNAME: no title or content set"
71 if [ -n
"$ARG_C" ]; then set -- "$@" $ARG_C "$OPT_C"; fi
72 if [ -n
"$OPT_ID" ]; then set -- "$@" --es id
"$OPT_ID"; fi
73 if [ -n
"$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi
74 if [ -n
"$ARG_U" ]; then set -- "$@" $ARG_U "$OPT_U"; fi
75 if [ -n
"$OPT_LED_COLOR" ]; then set -- "$@" --es led-color
"$OPT_LED_COLOR"; fi
76 if [ -n
"$OPT_LED_ON" ]; then set -- "$@" --ei led-on
"$OPT_LED_ON"; fi
77 if [ -n
"$OPT_LED_OFF" ]; then set -- "$@" --ei led-off
"$OPT_LED_OFF"; fi
78 if [ -n
"$OPT_PRIORITY" ]; then set -- "$@" --es priority
"$OPT_PRIORITY"; fi
79 if [ -n
"$OPT_SOUND" ]; then set -- "$@" --ez sound
"$OPT_SOUND"; fi
80 if [ -n
"$OPT_VIBRATE" ]; then set -- "$@" --ela vibrate
"$OPT_VIBRATE"; fi
82 @TERMUX_API@ Notification
"$@"