/alfred-workflow-todoist

An Alfred workflow for managing tasks in Todoist

Primary LanguageTypeScriptMIT LicenseMIT

Build Status Coverage Status CodeFactor GitHub Releases (by Asset)

ALFRED TODOIST WORKFLOW

Add and search Todoist tasks straight from Alfred. It uses Todoist stable v1 REST API.

Getting started Installation Configuration Usage Contributing

Getting started

For this workflow to work you need:

  • Alfred version 3.x or 4.x and a powerpack licence.
  • Node.js version 10.x or up

Note that the workflow expects node to be installed in the default location(s), i.e. /usr/local/bin or /usr/bin. See installation notes below on how to make the workflow work with non-standard node installations.

Installation

Download and import workflow.

Non-standard node installation

If you have installed node.js in a non-standard way (e.g. through nvm or homebrew), you may need to do either of the following to make the workflow work:

Create symlink to current node version:

  1. In the terminal, navigate to /usr/local/bin cd /usr/local/bin
  2. Create symlink to current node version ln -s $(which node) node (note, if you're using a different shell - fish, zsh, etc. - you may need to make slight changes to make the command work).

This method should work with different versions of nvm (including changing to other versions), as long as you don't remove the symlinked node version (or the symlink itself of course).

The downside is having problems switching between versions because most processes will default to the symlinked version.

Manually add node path to the workflow:

  1. In the terminal, reveal the path to your node installation which node
  2. Copy the output, but omit the executable (e.g. /Users/{user}/.nvm/versions/node/v11.6.0/bin, not /Users/{user}/.nvm/versions/node/v11.6.0/bin/node)
  3. Navigate to the workflow in Alfred Preferences Alfred Preferences -> Workflows-tab
  4. Click "Configure workflow and variables" in the top right corner and edit the node_path variable with the node path followed by a colon i.e. /Users/{user}/.nvm/versions/node/v11.6.0/bin:

Observe, variable will have to be updated whenever node version changes.

Node flags

If you need to enable any node.js command-line flags, you can with

  1. Navigate to the workflow in Alfred Preferences Alfred Preferences -> Workflows-tab
  2. Click "Configure workflow and variables" in the top right corner and edit the node_flag variable with the command-line flag i.e. --experimental-worker --experimental-modules

Debug

If the workflow doesn't work as expected, perform the following to get a clue about the issue:

  1. Navigate to the workflow in Alfred Preferences -> Workflows-tab
  2. Enable Debug mode (button in the top-right corner of the screen)
  3. Watch for messages in the bottom log-pane when using the workflow.

If the error messages outputs node errors, either make sure you have the appropriate node version or follow the steps above to enable the workflow with a non-standard node installation.

Configuration

Name Notation Explanation
token ^[0-9a-fA-F]{40}$ (default empty) The todoist API token.
language en, da, pl, zh, ko, de, pt, ja, it, fr, sv, ru, es, nl (default en) The language for natural language date processing (by todoist) and to calculate time to complete a task.
cache_timeout A positive number (default 3600, an hour) The time (in seconds) until the cache is refreshed (until that time todoist information is stored locally to make things a little faster)
anonymous_statistics true or false (default true) Doesn't do much at the moment but I intent to use it to track installs

todo:setting token {api token}

Example: todo:setting token 2d2e2a334c5f36e7a7c43b46e

todo:setting language {language}

Example: todo:setting language nl

todo:setting cache_timeout {time in seconds}

Example: todo:setting cache_timeout 13

todo:setting anonymous_statistics {true or false}

Example: todo:setting anonymous_statistics false

Usage

Name Notation Explanation
task Any text except , The task title.
date A date string See the Todoist documentation for supported date formats.
project Either #personal or #[next actions] Use either the hashtag notation or bracket notation if the project name has spaces in it. The project name is case sensitive.
label @label Label names can't contain any whitespace characters. Labels are case insensitive.
priority Either p2 or !!2 A value between 1 (urgent) and 4 (normal)

Search for tasks

todos {query}

Query

Any search query one character or longer. Uses fuzzy search to find the tasks.

Example: todos car => returns (because of fuzzy search):

  • Rent car
  • New cat recipe's
  • Cut Grass tomorrow

Create task

todo {task}, {date}

Example: todo Get things done, tomorrow @ 9 Example: todo Build tree house #home !!2 @15min, tomorrow @ 9

Important

For date parsing the work the date needs to be the only thing after the comma.

The reason for this is that multilanguage date string parsing is hard, and Todoist has already solved this problem. But in order to have Todoist read the date the workflow needs to present it a string that holds just the date. The workflow does this by having the date string between a comma and the end of the string.

Documentation

Read the docs.

Changelog

View CHANGELOG.md

Contributing

Instructions

Build

Create a new build with

npm run build

Create a distributable package (.alfredworkflow) after the build step with

npm run build:workflow

Run tests

Run Jest test suite with:

npm run test npm run test:prod

Or run a watcher with

npm run test:watch

Commits

For commits I follow the angular commit guidelines and use semantic release to automate builds, semver version updates and changelog creation. The way to make sure this all works is to run:

npm run commit

Which guides you through the motions

Code of conduct

Code of Conduct

License

License MIT © Martien Oranje