From 9d16ecc8957fcc7d39108f20750bc90408fb47c6 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 5 Apr 2021 17:13:49 +0300 Subject: script: tracking done and related config --- .config/i3/config##c.desktop,h.maus | 7 ++++-- .local/bin/done | 47 +++++++++++++++++++++++++++++++++++++ .taskrc##c.desktop,h.maus | 12 ++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100755 .local/bin/done diff --git a/.config/i3/config##c.desktop,h.maus b/.config/i3/config##c.desktop,h.maus index 2889398..7254417 100644 --- a/.config/i3/config##c.desktop,h.maus +++ b/.config/i3/config##c.desktop,h.maus @@ -43,8 +43,11 @@ font pango:Iosevka 11 # bindings # ############## +# done, {task,timew}warrior control suite +bindcode $mod+42 exec --no-startup-id ~/.local/bin/done + # type the contents of the clipboard with mod+p -bindcode --release $mod+27 exec --no-startup-id /home/yigit/.local/bin/type_clipboard.sh +bindcode --release $mod+27 exec --no-startup-id ~/.local/bin/type_clipboard.sh # launch emoji picker with mod+c bindcode $mod+54 exec --no-startup-id rofimoji --skin-tone neutral @@ -77,7 +80,7 @@ bindcode $mod+Shift+20 move scratchpad bindcode $mod+20 scratchpad show # pause notifications for a while with mod+shift+y -bindcode $mod+Shift+32 exec /home/yigit/.local/bin/toggle_notifications.sh +bindcode $mod+Shift+32 exec ~/.local/bin/toggle_notifications.sh # shortcuts for frequent programs 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 @@ +#!/bin/bash + +# we `start` tasks through taskwarrior which uses a hook to start them in +# timewarrior + +# DONE: START: get the tasks for the current context, start using rofi selection +# DONE: STOP: get the current task (task active output), either pause it (task $1 stop) or complete it (task $1 done) +# DONE: DONE: ask how the task went, timew @1 annotate '[1-5]' + +function say_cancel { notify-send "cancelling, no action taken" "" --app-name="done" --icon="dialog-cancel"; } + +if ACTIVE_TASK=$(task active); then + + task_id=$(echo "${ACTIVE_TASK}" | head -n4 | tail -n1 | cut -d' ' -f1) + task_description=$(echo "${ACTIVE_TASK}" | head -n4 | tail -n1 | cut -d' ' -f2-) + + if choice=$(printf "done\npause" | rofi -dmenu -p "${task_description}" -lines 2 -no-custom); then + + if [[ ${choice} == "done" ]]; then + task "done" "${task_id}" + notify-send "👏👏👏 good work there" "task ${task_description} is complete" --app-name="done" --icon="checkmark" + + 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 + timew "@1" annotate "${annot:0:1}" + fi + + elif [[ ${choice} == "pause" ]]; then + task "stop" "${task_id}" + notify-send "🛑 let's put a pause on this" "stopping task ${task_description}" --app-name="done" --icon="dialog-apply" + else + echo "this is impossible..." + exit 1 + fi + else + say_cancel + fi +else + if wanna_start=$(printf '%s' "$(task custom_done | tail -n +4 | head -n -2)" | rofi -dmenu -p 'select a task' -i -no-custom); then + task_id=$(echo "${wanna_start}" | xargs | cut -d' ' -f1) + task_description=$(echo "${wanna_start}" | xargs | cut -d' ' -f2-) + + task "start" "${task_id}" + notify-send "good luck then" "🤓 ${task_description} now" --app-name="done" --icon="go-next" + else + say_cancel + fi +fi diff --git a/.taskrc##c.desktop,h.maus b/.taskrc##c.desktop,h.maus index dbd9024..cea901b 100644 --- a/.taskrc##c.desktop,h.maus +++ b/.taskrc##c.desktop,h.maus @@ -91,6 +91,18 @@ report.next.filter = +UNBLOCKED status:pending and +next report.next.labels = ID,Active,Age,Urgency,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Brainpower report.next.sort = brainpower-,priority-,urgency- +### bin/done selection +report.custom_done.description = Brief next task list +report.custom_done.columns = id,description,due.remaining +report.custom_done.filter = +UNBLOCKED status:pending and +next +report.custom_done.labels = ID,Description,Due +report.custom_done.sort = brainpower-,priority-,urgency- + +### override 'active' report +report.active.description = Current task +report.active.labels = ID,Description +report.active.columns = id,description + calendar.details=full taskd.credentials=me\/yigit sever\/765df4a2-6c6c-408b-a266-17117e944f4e taskd.certificate=\/home\/yigit\/.local\/share\/task\/maus.cert.pem -- cgit v1.2.3-70-g09d2