From c3401648d6b300a2455f9d3a4ee846234d27c150 Mon Sep 17 00:00:00 2001 From: Ultrabug Date: Mon, 3 Aug 2015 15:49:43 +0200 Subject: taskwarrior module: QA and python3 support --- py3status/modules/taskwarrior.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/py3status/modules/taskwarrior.py b/py3status/modules/taskwarrior.py index 75faa8f..65407e5 100644 --- a/py3status/modules/taskwarrior.py +++ b/py3status/modules/taskwarrior.py @@ -3,7 +3,7 @@ Display currently active (started) taskwarrior tasks. Configuration parameters: - - cache_timeout : how often we refresh this module in seconds + - cache_timeout : how often we refresh this module in seconds (5s default) Requires - task @@ -15,20 +15,23 @@ Requires # import your useful libs here from time import time from subprocess import check_output -import shlex import json +import shlex class Py3status: + """ + """ + # available configuration parameters cache_timeout = 5 def taskWarrior(self, i3s_output_list, i3s_config): - command = "task start.before:tomorrow status:pending export" + command = 'task start.before:tomorrow status:pending export' taskwarrior_output = check_output(shlex.split(command)) - tasks_json = json.loads("[" + taskwarrior_output + "]") + tasks_json = json.loads('[' + taskwarrior_output.decode('utf-8') + ']') def describeTask(taskObj): - return str(taskObj['id']) + " " + taskObj['description'] + return str(taskObj['id']) + ' ' + taskObj['description'] result = ', '.join(map(describeTask, tasks_json)) response = { -- cgit v1.3