Using Timewarrior on multiple devices

For a few weeks, I’ve been tracking my time with Timewarrior on the desktop. At some point, I missed also having it available on other devices, namely my phone.

Unlike its sibling Taskwarrior, it lacks a synchronization server, or any official way of using it on multiple machines. So, at first, you are stuck at only using it on one device. However, there is an easy fix for that, and in this post I’ll describe it.

TL;DR: Install timewarrior on a server and set an alias to run it through SSH.

My solution

  1. Pick a Linux host that is always available from any of your devices.

    It could be a Raspberry Pi at your home, a VPS, etc.

  2. Install Timewarrior on that host.

    This is where your data will be stored and controlled.

  3. Make sure your devices have SSH access to that host.

    I suggest you to use key-based authentication. Besides being more secure, you don’t have to type your password each time, which will come in handy for this.

  4. On your devices, add a shell alias for Timewarrior.

    Something such as alias timew=ssh THE_HOST timew :color.

    The :color option forces color on, since this ssh command won’t allocate a tty.

  5. Make the SSH connection to that host persistent.

    I would get a delay each time I run the timew alias. I solved this by making the connection persist. This way, only the first invocation would get the delay.

    There are some ways of doing that. I created a directory at ~/.ssh/sockets and wrote this to my ~/.ssh/config:

    Host THE_HOST
    ControlMaster auto
    ControlPath  ~/.ssh/sockets/%r@%h-%p
    ControlPersist 600

Done. Now just use Timewarrior normally. Every time you type timew on your devices, you’ll get to your same, “synchronized” data.

See all posts