/task2hab

Primary LanguagePython

Taskwarrior Habitica Hook

This is a hook for Taskwarrior that connects its task activities to Habitica.

It responds to the add/edit/delete actions and carries the activity to Habitica. It does not bring Habitica actions back down to Taskwarrior.

It maps Taskwarrior Priority to Habitica Difficulty:

  • Low: Trivial
  • None: Easy (Default)
  • Medium: Medium
  • High: Hard

Architecture

To keep from polluting the local system, this application runs as an unprivileged Docker container. When the hook fires, it passes the task into the container on STDIN, along with the arguments of the command that triggered the hook. The container executes a Python script to interact with Habitica.

Installation

  1. Pull the Docker container to the system where you run Taskwarrior.

    docker pull monachus/task2hab:latest
  2. Add the Habitica UID and API Key to your .taskrc

    habitica.api_user=ad34dbf-526e-41ec-bfd7-58824595f9f3
    habitica.api_key=3f8a33d0-6eb1-4118-a74c-509bc3afe308
  3. Install the hook file

    mkdir ~/.task/hooks/task2hab
    cp task2hab.sh ~/.task/hooks/task2hab
    ln -s ~/.task/hooks/task2hab/task2hab.sh ~/.task/on-add.05.task2hab
    ln -s ~/.task/hooks/task2hab/task2hab.sh ~/.task/on-modify.05.task2hab

Usage

Use task add, task edit, task done, and task delete. If you have existing tasks in Taskwarrior that aren't in Habitica, they will be added to Habitica when you first interact with the task.

Removing the Hooks

  1. Delete the hooks

    rm ~/.task/hooks/*.task2hab
    rm -fr ~/.task/hooks/task2hab
  2. Delete the container image

    docker rmi monachus/task2hab:latest

Credits

  • The original Python 2 script came from fplourde.
  • Modifications for Python 3 came from Shadow53.