polybar: todoist
This commit is contained in:
parent
2292904765
commit
fc2f9c0c1f
2 changed files with 0 additions and 44 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
Loading…
Reference in a new issue