summaryrefslogtreecommitdiff
path: root/.local/bin/dwmbar/dwmb-todoist
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dwmbar/dwmb-todoist')
-rwxr-xr-x.local/bin/dwmbar/dwmb-todoist22
1 files changed, 22 insertions, 0 deletions
diff --git a/.local/bin/dwmbar/dwmb-todoist b/.local/bin/dwmbar/dwmb-todoist
new file mode 100755
index 0000000..69a59a0
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-todoist
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+touch ~/.cache/todoist
+
+ping -c1 1.1.1.1 >/dev/null 2>&1 && curl -X GET \
+ https://api.todoist.com/rest/v1/tasks \
+ -H "Authorization: Bearer $(pass Todoist/API)" |\
+ jq ".[]|select(.completed == false)|select(.project_id == 2250555849)" |\
+ grep '"id"' | wc -l > ~/.cache/todoist
+
+num=$(cat ~/.cache/todoist)
+
+printf "  $num "
+
+case $BUTTON in
+ 1) dropdowntoggle todoist nvim +"Todoist" && \
+ kill -39 $(pidof dwmblocks) ;;
+ 2) notify-send -a " Todoist" "- Left click to open Todoist.Nvim
+ - Right click to open todoist in your web browser" ;;
+ 3) setsid $BROWSER "https://todoist.com/app/today" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac