Here is the script I’ve written to display on conky next Tasque ToDo items:
#!/usr/bin/env python import sqlite3 from os.path import expanduser import pprint from sys import argv from math import ceil limit = 0 widthLimit = 0 if len(argv) > 1: limit = int(argv[1]) if len(argv) > 2: widthLimit = int(argv[2]) con = sqlite3.connect(expanduser("~/.config/tasque/sqlitebackend.db")) con.isolation_level = None cur = con.cursor() counter = 0 for lastIteration in range(0,2): if lastIteration == 0: cur.execute("SELECT Name, State FROM Tasks WHERE DueDate >= 0 ORDER BY DueDate asc, Name COLLATE NOCASE asc;") else: cur.execute("SELECT Name, State FROM Tasks WHERE DueDate < 0 ORDER BY Name COLLATE NOCASE asc;") currentItem = cur.fetchone() while currentItem and ((limit != 0 and counter < limit) or limit == 0): if(currentItem[1] == 0): if(widthLimit == 0): print currentItem[0].encode("utf-8") else: for i in range(int(ceil(len(currentItem[0].encode("utf-8"))/widthLimit + 1))): print currentItem[0].encode("utf-8")[i*widthLimit:(i+1)*widthLimit] counter+=1 currentItem = cur.fetchone() con.close()
The .conkyrc line to display 5 next ToDo items using this script is:
${exec tasqueTasksScript 5}If you want to go to the next line after 50 characters, use:
${exec tasqueTasksScript 5 50}


#1 by Adam on June 10, 2010 - 6:34 pm
Don’t know anything about python, but I have been using your script and it works perfectly, thanks. Question though, how would I go about adding the due date in-line with the task?
#2 by Boris on June 16, 2010 - 2:04 pm
Actually, it doesn’t respect the priorities. I’ll upgrade the script when I’ll be able to make it doing it correctly
Also, I’ll add a “format string” to the parameters, just in case you want to display something like the date, for example
Stay tuned, I’ll do it asap.