summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2024-08-08 12:20:54 +0200
committerYigit Sever2024-08-08 12:21:27 +0200
commit9bba59cd6d6f59621f33e11bb975f203ceb34826 (patch)
treef68feb65702df8d0445bf94441c8915d02914df6
parent45550488f9f4effc3b9dc5bc0fc4c25c130d69fd (diff)
downloaddotfiles-9bba59cd6d6f59621f33e11bb975f203ceb34826.tar.gz
dotfiles-9bba59cd6d6f59621f33e11bb975f203ceb34826.tar.bz2
dotfiles-9bba59cd6d6f59621f33e11bb975f203ceb34826.zip
done: tofi/rofi distinction
-rwxr-xr-x.local/bin/done##default (renamed from .local/bin/done)0
-rwxr-xr-x.local/bin/done##h.qualle62
2 files changed, 62 insertions, 0 deletions
diff --git a/.local/bin/done b/.local/bin/done##default
index 950541c..950541c 100755
--- a/.local/bin/done
+++ b/.local/bin/done##default
diff --git a/.local/bin/done##h.qualle b/.local/bin/done##h.qualle
new file mode 100755
index 0000000..d2580ca
--- /dev/null
+++ b/.local/bin/done##h.qualle
@@ -0,0 +1,62 @@
1#!/usr/bin/env bash
2
3# we `start` tasks through taskwarrior which uses a hook to start them in
4# timewarrior
5
6function say_cancel { notify-send "cancelling, no action taken" "" --app-name="done" --icon="dialog-cancel"; }
7
8if ACTIVE_TASK=$(task active); then
9 # We have a running task
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" | tofi --prompt-text="${task_description}"); then
14 # complete or pause the task, closing tofi doesn't touch the task
15 if [[ -z $choice ]]; then
16 say_cancel
17 exit
18 fi
19
20 if [[ ${choice} == "done" ]]; then
21 task "done" "${task_id}"
22 notify-send "👏 good work there" "task ${task_description} is complete" --app-name="done" --icon="checkmark"
23 elif [[ ${choice} == "pause" ]]; then
24 task "stop" "${task_id}"
25 notify-send "🛑 let's put a pause on this" "stopping task ${task_description}" --app-name="done" --icon="dialog-apply"
26 else
27 echo "this is impossible..."
28 exit 1
29 fi
30
31 if annot=$(printf "5 - perfect flow\n4 - progress, still\n3 - rather be somewhere else\n2 - ugh\n1 - not even" | tofi --prompt-text="${task_description}"); then
32
33 if [[ -z $annot ]]; then
34 # exited out from annotation, is something wrong?
35 if maybe_delete=$(printf "no no\nyea" | tofi --prompt-text="should we delete the tracking?"); then
36 if [[ ${maybe_delete} == "no no" ]]; then
37 notify-send "tracking unannotated, not deleted" "nobody will know how that went" --app-name="done" --icon="itmages-question"
38 elif [[ ${maybe_delete} == "yea" ]]; then
39 timew delete "@1"
40 notify-send "tracking deleted" "like you never worked on that" --app-name="done" --icon="pack-more"
41 fi
42 fi
43 fi
44 timew "@1" annotate "${annot:0:1}"
45 fi
46 fi
47else
48 # No running task, maybe start one?
49 if wanna_start=$(printf '%s' "$(task custom_done | tail -n +4 | head -n -2)" | tofi --prompt-text="select a task: "); then
50 if [[ -z $wanna_start ]]; then # empty, above prompt exited
51 say_cancel
52 exit
53 fi
54
55 # picked a task, start it
56 task_id=$(echo "${wanna_start}" | xargs | cut -d' ' -f1)
57 task_description=$(echo "${wanna_start}" | xargs | cut -d' ' -f2-)
58
59 task "start" "${task_id}"
60 notify-send "good luck" "${task_description} now" --app-name="done" --icon="go-next"
61 fi
62fi