idpaterson / alfred-wunderlist-workflow

Unbelievably fast task entry in Wunderlist with due dates, reminders, and recurrence
297 stars 8 forks source link

Ensure that the workflow acts on the most recent text entry in Alfred #57

Closed idpaterson closed 9 years ago

idpaterson commented 9 years ago

Script filters have always been problematic due to the inevitable short delay between the user typing and the workflow relaying results to Alfred. Each item displayed in Alfred can either autocomplete to change the query text, or submit a query to the next action in the workflow.

In the latter case, the query sent to the next action is based on the user's query at the time to results were generated. If the user continues typing then presses Enter before the results are regenerated, those generated queries are all outdated. This most commonly results in missing characters from the end of task and list names.

Alfred allows running the script filter command immediately after every keystroke. Since the python script will take 150-200ms just to load, it's not useful for tracking the latest search query. Instead, the script filter bash command should simply write the query to a file. When executed with the --commit option (and potentially even when providing filter results but that may not work) the query should be taken from the file rather than what's sent to Alfred.

This won't work in cases where the committed arg is not related to the query, so it should probably be implemented as a special keyword that can be returned as the arg of a script filter entry. If that keyword is present, take the query from the file rather than from Alfred. Currently, this should be used for task and list creation but probably nothing else.

idpaterson commented 9 years ago

This seems to work well and will be released in the second beta.