You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/termux-notification
+27-2Lines changed: 27 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@ set -e -u -f
4
4
SCRIPTNAME=termux-notification
5
5
show_usage () {
6
6
echo"Usage: termux-notification [options]"
7
-
echo"Display a system notification. Content text is specified using -c/--content or read from stdin ."
7
+
echo"Display a system notification. Content text is specified using -c/--content or read from stdin."
8
+
echo"Please read --help-actions for help with action arguments."
8
9
echo" --action action action to execute when pressing the notification"
9
10
echo" --alert-once do not alert when the notification is edited"
10
11
echo" --button1 text text to show on the first notification button"
@@ -16,6 +17,7 @@ show_usage () {
16
17
echo" -c/--content content content to show in the notification. Will take precedence over stdin."
17
18
echo" --group group notification group (notifications with the same group are shown together)"
18
19
echo" -h/--help show this help"
20
+
echo" --help-actions show the help for actions"
19
21
echo" -i/--id id notification id (will overwrite any previous notification with the same id)"
20
22
echo" --image-path path absolute path to an image which will be shown in the notification"
21
23
echo" --led-color rrggbb color of the blinking led as RRGGBB (default: none)"
@@ -36,6 +38,28 @@ show_usage () {
36
38
exit 0
37
39
}
38
40
41
+
show_help_actions () {
42
+
echo"This help refers to the arguments to options like --action, --on-delete, --button-1-action and --media-next."
43
+
echo
44
+
echo"All these commands take an action string as their argument, which is fed to \`dash -c\`."
45
+
echo"A few important things must be kept in mind when using actions:"
46
+
echo
47
+
echo"You should use actions that do things outside of the terminal, like --action \"termux-toast hello\"."
48
+
echo"Anything that outputs to the terminal is useless, so the output should either be redirected (--action \"ls > ~/ls.txt\") or shown to the user in a different way (--action \"ls|termux-toast\")."
49
+
echo
50
+
echo"Running more than one command in a single action is as easy as"
echo"For anything more complex, you should put your script in a file, make it executable, and use that as the action:"
56
+
echo"--action ~/bin/script"
57
+
echo
58
+
echo"The action is run in a different environment (not a subshell). Thus your environment is lost (most notably \$PATH), and ~/.profile is not sourced either. So if you need your \$PATH you should either:"
59
+
echo" - if the action is a script, set it explicitly in the script (e.g. export PATH=\"\$HOME/bin:\$PATH\")"
60
+
echo" - or use something like --action \"bash -l -c 'command1; command2'\")."
0 commit comments