summaryrefslogtreecommitdiff
path: root/.local/bin/dwmbar/dwmb-todoist
blob: 69a59a0fde76e4b934f96ad0e305a34f263a74de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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