Skip to content

Commit

Permalink
termux-notification: allow using STDIN as content
Browse files Browse the repository at this point in the history
... without hanging the script

fixes termux/termux-api#271 and #71
  • Loading branch information
xalexalex authored and fornwall committed Aug 7, 2019
1 parent d9e1d69 commit d803d16
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/termux-notification
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,10 @@ if [ -n "$OPT_TITLE" ]; then set -- "$@" --es title "$OPT_TITLE"; fi
if [ -n "$OPT_TYPE" ]; then set -- "$@" --es type "$OPT_TYPE"; fi
if [ -n "$OPT_VIBRATE" ]; then set -- "$@" --ela vibrate "$OPT_VIBRATE"; fi

echo "$OPT_CONTENT" | /data/data/com.termux/files/usr/libexec/termux-api Notification "$@"
if [ -n "$OPT_CONTENT" ] || [ -t 0 ]; then
# we either have some content, so it takes precedence over STDIN
# or have no STDIN, so we must use content even if empty
echo "$OPT_CONTENT" | /data/data/com.termux/files/usr/libexec/termux-api Notification "$@"
else # use STDIN
/data/data/com.termux/files/usr/libexec/termux-api Notification "$@"
fi

0 comments on commit d803d16

Please sign in to comment.