diff --git a/info.plist b/info.plist index 7e4e353..2cc55b1 100644 --- a/info.plist +++ b/info.plist @@ -164,6 +164,19 @@ + 9AE65283-7430-42F9-9DE5-7331FB4ACF49 + + + destinationuid + D43529C9-5BC5-4DCA-A1F7-9EB2E48F2E68 + modifiers + 0 + modifiersubtext + + vitoclose + + + AEA7E1B6-D264-4723-ABE3-9A224C6232E0 @@ -549,6 +562,49 @@ version 2 + + config + + alfredfiltersresults + + argumenttype + 0 + escaping + 102 + keyword + .se + queuedelaycustom + 3 + queuedelayimmediatelyinitially + + queuedelaymode + 1 + queuemode + 1 + runningsubtext + Searching... + script + /usr/bin/python search.py -e "{query}" + scriptargtype + 0 + scriptfile + + subtext + Search OmniFocus for "{query}" + title + Search OmniFocus for processed and inbox tasks + type + 0 + withspace + + + type + alfred.workflow.input.scriptfilter + uid + 9AE65283-7430-42F9-9DE5-7331FB4ACF49 + version + 2 + config @@ -1282,6 +1338,13 @@ Well, I want it because I can't quickly search for, say, a task within OmniFocus ypos 560 + 9AE65283-7430-42F9-9DE5-7331FB4ACF49 + + xpos + 120 + ypos + 200 + AEA7E1B6-D264-4723-ABE3-9A224C6232E0 xpos diff --git a/queries.py b/queries.py index 6885680..f200190 100644 --- a/queries.py +++ b/queries.py @@ -8,14 +8,13 @@ TASK_FROM = ("((task tt left join projectinfo pi on tt.containingprojectinfo=pi.pk) t left join " "task p on t.task=p.persistentIdentifier) left join " "context c on t.context = c.persistentIdentifier") -TASK_WHERE = ("(t.effectiveInInbox = 0 AND t.inInbox = 0) AND " - "t.containingProjectInfo <> t.persistentIdentifier ") +TASK_WHERE = "(t.containingProjectInfo <> t.persistentIdentifier OR t.containingProjectInfo is NULL) " TASK_NAME_WHERE = "t.dateCompleted IS NULL AND lower(t.name) LIKE lower('%{0}%') AND " ACTIVE_CLAUSE = "t.blocked = 0 AND " CTX_SELECT = "persistentIdentifier, name, allowsNextAction, active, availableTaskCount" -def search_tasks(active_only, flagged, query): +def search_tasks(active_only, flagged, query, everything=None): where = (TASK_NAME_WHERE + TASK_WHERE).format(query) if active_only: @@ -24,6 +23,9 @@ def search_tasks(active_only, flagged, query): if flagged: where = "(t.flagged = 1 OR t.effectiveFlagged = 1) AND " + where + if not everything: + where = "(t.effectiveInInbox = 0 AND t.inInbox = 0) AND " + where + return _generate_query(TASK_SELECT, TASK_FROM, where, "t." + NAME_SORT) diff --git a/search.py b/search.py index 3b01308..fdba0f5 100644 --- a/search.py +++ b/search.py @@ -112,6 +112,8 @@ def populate_query(args): active_only = args.active_only flagged_only = args.flagged_only + everything = args.everything + if args.type == PROJECT: log.debug('Searching projects') sql = queries.search_projects(active_only, query) @@ -132,7 +134,7 @@ def populate_query(args): sql = queries.show_recent_tasks(active_only) else: log.debug('Searching tasks') - sql = queries.search_tasks(active_only, flagged_only, query) + sql = queries.search_tasks(active_only, flagged_only, query, everything) return sql @@ -142,6 +144,8 @@ def parse_args(): help='search for active tasks only') parser.add_argument('-g', '--flagged-only', action='store_true', help='search for flagged tasks only') + parser.add_argument('-e', '--everything', action='store_true', + help='search for tasks in the inbox as well as processed tasks') parser.add_argument('-t', '--type', default=TASK, choices=[INBOX, TASK, PROJECT, CONTEXT, PERSPECTIVE, FOLDER, NOTES, RECENT], type=str, help='What to search for: (b)oth tasks and projects, (t)ask, '