From fc2f9c0c1feaac78782f3b7f9338745e0eff260f Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Wed, 30 Jun 2021 21:19:35 +0200 Subject: [PATCH] polybar: todoist --- polybar/config | 9 --------- polybar/scripte/todoist.py | 35 ----------------------------------- 2 files changed, 44 deletions(-) delete mode 100644 polybar/scripte/todoist.py diff --git a/polybar/config b/polybar/config index a6906ac..ee0f7df 100644 --- a/polybar/config +++ b/polybar/config @@ -51,15 +51,6 @@ tray-background = #888888 cursor-click = pointer cursor-scroll = ns-resize -[module/todoist] -type = custom/script -exec = python3 -u /home/mg/dotfiles/polybar/scripte/todoist.py -tail = true -click-left = xdg-open https://todoist.com -format-prefix = "TODO " -format-prefix-foreground = ${colors.foreground-alt} - - [module/nightscout_script] type = custom/script exec = /home/mg/dotfiles/polybar/scripte/nightscout_cgm.sh diff --git a/polybar/scripte/todoist.py b/polybar/scripte/todoist.py deleted file mode 100644 index dd32c00..0000000 --- a/polybar/scripte/todoist.py +++ /dev/null @@ -1,35 +0,0 @@ -import subprocess -import datetime -import todoist -import time - -def api_token(): - return XXX - - -def filter_dueToday(item): - if item['checked']: return False; - if item['due'] == None: return False; - - duedate = datetime.datetime.strptime(item['due']['date'][0:10],'%Y-%m-%d').date() - - return duedate == datetime.date.today() - - -def countTasks(items): - count = {1: 0, 2: 0, 3: 0, 4: 0} - for item in items: - count[item['priority']] += 1 - return count - - -api = todoist.TodoistAPI(api_token()) - -while True: - try: - api.sync() - count = countTasks(api.items.all(filt=filter_dueToday)) - print('%{{B#de4c4a}} {0[4]} %{{B-}}%{{B#f49c18}} {0[3]} %{{B-}}%{{B#4073d6}} {0[2]} %{{B-}}%{{B#444444}} {0[1]} %{{B-}}'.format(count)) - except: - print(' ERROR ') - time.sleep(10)