summaryrefslogtreecommitdiffstats
path: root/.local/bin/done
diff options
context:
space:
mode:
authorYigit Sever2021-04-05 17:13:49 +0300
committerYigit Sever2021-04-05 17:13:49 +0300
commit9d16ecc8957fcc7d39108f20750bc90408fb47c6 (patch)
treebd5577d009943e3ade97137d9694bd86714cc25e /.local/bin/done
parentc6bfbc49304afbd9d09ed597a4ccb1a09c59a0f9 (diff)
downloaddotfiles-9d16ecc8957fcc7d39108f20750bc90408fb47c6.tar.gz
dotfiles-9d16ecc8957fcc7d39108f20750bc90408fb47c6.tar.bz2
dotfiles-9d16ecc8957fcc7d39108f20750bc90408fb47c6.zip
script: tracking done and related config
Diffstat (limited to '.local/bin/done')
-rwxr-xr-x.local/bin/done47
1 files changed, 47 insertions, 0 deletions
diff --git a/.local/bin/done b/.local/bin/done
new file mode 100755
index 0000000..f2641f2
--- /dev/null
+++ b/.local/bin/done
@@ -0,0 +1,47 @@
1#!/bin/bash
2
3# we `start` tasks through taskwarrior which uses a hook to start them in
4# timewarrior
5
6# DONE: START: get the tasks for the current context, start using rofi selection
7# DONE: STOP: get the current task (task active output), either pause it (task $1 stop) or complete it (task $1 done)
8# DONE: DONE: ask how the task went, timew @1 annotate '[1-5]'
9
10function say_cancel { notify-send "cancelling, no action taken" "" --app-name="done" --icon="dialog-cancel"; }
11
12if ACTIVE_TASK=$(task active); then
13
14 task_id=$(echo "${ACTIVE_TASK}" | head -n4 | tail -n1 | cut -d' ' -f1)
15 task_description=$(echo "${ACTIVE_TASK}" | head -n4 | tail -n1 | cut -d' ' -f2-)
16
17 if choice=$(printf "done\npause" | rofi -dmenu -p "${task_description}" -lines 2 -no-custom); then
18
19 if [[ ${choice} == "done" ]]; then
20 task "done" "${task_id}"
21 notify-send "👏👏👏 good work there" "task ${task_description} is complete" --app-name="done" --icon="checkmark"
22
23 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
24 timew "@1" annotate "${annot:0:1}"
25 fi
26
27 elif [[ ${choice} == "pause" ]]; then
28 task "stop" "${task_id}"
29 notify-send "🛑 let's put a pause on this" "stopping task ${task_description}" --app-name="done" --icon="dialog-apply"
30 else
31 echo "this is impossible..."
32 exit 1
33 fi
34 else
35 say_cancel
36 fi
37else
38 if wanna_start=$(printf '%s' "$(task custom_done | tail -n +4 | head -n -2)" | rofi -dmenu -p 'select a task' -i -no-custom); then
39 task_id=$(echo "${wanna_start}" | xargs | cut -d' ' -f1)
40 task_description=$(echo "${wanna_start}" | xargs | cut -d' ' -f2-)
41
42 task "start" "${task_id}"
43 notify-send "good luck then" "🤓 ${task_description} now" --app-name="done" --icon="go-next"
44 else
45 say_cancel
46 fi
47fi