Übersicht 类似 GeekTool,能在Mac桌面放置 widget,各种有趣的小东西。
挑了三个,Simple Clock、Weather、Omnifocus Flag。
其中 OmniFocus Flag 显示当天标记的任务,但是还缺少到期任务。
修改 of-flaggedTasks.scpt文件,完成:
of = Application('OmniFocus');
doc = of.defaultDocument;
getFlaggedAndDueTasks();
function getFlaggedAndDueTasks(){
taskList = [];
tasks = doc.flattenedTasks.whose({completed: false, flagged: true})();
var today = new Date();
tasks.forEach(function(task){
if ( (!task.deferDate()) || (today > task.deferDate())) {
context = (task.context() !== null) ? task.context().name() : '';
project = (task.container() !== null) ? task.container().name() : '';
taskList.push({
name: task.name(),
id: task.id(),
context: context,
project: project,
note: task.note(),
});
}
});
tasks = doc.flattenedTasks.whose({completed: false, flagged: false})();
tasks.forEach(function(task){
if ( task.dueDate() && (today >= task.dueDate())) {
context = (task.context() !== null) ? task.context().name() : '';
project = (task.container() !== null) ? task.container().name() : '';
taskList.push({
name: task.name(),
id: task.id(),
context: context,
project: project,
note: task.note(),
});
}
});
retObj = {
'tasks' : taskList,
'count' : taskList.length
};
return JSON.stringify(retObj);
}