diff options
Diffstat (limited to '.local/bin/done##default')
-rwxr-xr-x | .local/bin/done##default | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/.local/bin/done##default b/.local/bin/done##default new file mode 100755 index 0000000..950541c --- /dev/null +++ b/.local/bin/done##default | |||
@@ -0,0 +1,50 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # we `start` tasks through taskwarrior which uses a hook to start them in | ||
4 | # timewarrior | ||
5 | |||
6 | function say_cancel { notify-send "cancelling, no action taken" "" --app-name="done" --icon="dialog-cancel"; } | ||
7 | |||
8 | if ACTIVE_TASK=$(task active); then | ||
9 | |||
10 | task_id=$(task active_task_id | xargs | cut -d' ' -f3) | ||
11 | task_description=$(echo "${ACTIVE_TASK}" | head -n4 | tail -n1 | cut -d' ' -f2-) | ||
12 | |||
13 | if choice=$(printf "done\npause" | rofi -dmenu -p "${task_description}" -lines 2 -no-custom); then | ||
14 | if [[ ${choice} == "done" ]]; then | ||
15 | task "done" "${task_id}" | ||
16 | notify-send "👏👏👏 good work there" "task ${task_description} is complete" --app-name="done" --icon="checkmark" | ||
17 | elif [[ ${choice} == "pause" ]]; then | ||
18 | task "stop" "${task_id}" | ||
19 | notify-send "🛑 let's put a pause on this" "stopping task ${task_description}" --app-name="done" --icon="dialog-apply" | ||
20 | else | ||
21 | echo "this is impossible..." | ||
22 | exit 1 | ||
23 | fi | ||
24 | |||
25 | if annot=$(printf "5 - perfect flow\n4 - progress, still\n3 - rather be somewhere else\n2 - ugh\n1 - not even" | rofi -dmenu -p "${task_description}" -lines 5 -no-custom); then | ||
26 | timew "@1" annotate "${annot:0:1}" | ||
27 | else | ||
28 | if maybe_delete=$(printf "no no\nyea" | rofi -dmenu -p "should we delete the tracking?" -lines 2 -no-custom); then | ||
29 | if [[ ${maybe_delete} == "no no" ]]; then | ||
30 | notify-send "tracking unannotated, not deleted" "nobody will know how that went" --app-name="done" --icon="itmages-question" | ||
31 | elif [[ ${maybe_delete} == "yea" ]]; then | ||
32 | timew delete "@1" | ||
33 | notify-send "tracking deleted" "like you never worked on that" --app-name="done" --icon="pack-more" | ||
34 | fi | ||
35 | fi | ||
36 | fi | ||
37 | else | ||
38 | say_cancel | ||
39 | fi | ||
40 | else | ||
41 | if wanna_start=$(printf '%s' "$(task custom_done | tail -n +4 | head -n -2)" | rofi -dmenu -p 'select a task' -i -no-custom); then | ||
42 | task_id=$(echo "${wanna_start}" | xargs | cut -d' ' -f1) | ||
43 | task_description=$(echo "${wanna_start}" | xargs | cut -d' ' -f2-) | ||
44 | |||
45 | task "start" "${task_id}" | ||
46 | notify-send "good luck then" "🤓 ${task_description} now" --app-name="done" --icon="go-next" | ||
47 | else | ||
48 | say_cancel | ||
49 | fi | ||
50 | fi | ||