-
Notifications
You must be signed in to change notification settings - Fork 1
/
task-popup
executable file
·32 lines (21 loc) · 966 Bytes
/
task-popup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/data/data/com.termux/files/usr/bin/bash
date_format(){
date -I -d "$(echo $1 | sed -r 's/(....)(..)(..)T(..)(..)(..)Z/\1-\2-\3 \4:\5:\6/')"
}
task status:pending or status:active export | jq -c '.[]' | while read i; do
typeset -A task
while IFS== read -r key value; do
task["$key"]="$value"
done < <(echo "$i" | jq -r 'to_entries | .[] | .key + "=" + (.value|tostring)')
content="Status ${task[status]} "
if [ -n "${task[project]}" ] ; then
content+="Project: ${task[project]}/n \n"
fi
if [ -n "${task[due]}" ] ; then
content+="Due: $(date_format ${task[due]})"
fi
notification="termux-notification --title \"${task[description]}\" --id \"${task[uuid]}\""
notification="$notification --button1 \"Done\" --button1-action \"termux-notification-remove ${task[uuid]} && task done ${task[uuid]}\""
notification="$notification --button2 \"Modify\" --button2-action \"modify-task\" --content \"$content\""
eval $notification &
done