λ ryan.himmelwright.net

Timewarrior Trial - My iOS Shortcut

Three iPhone screenshots showing a simple shortcut prompt and then text result
I made an iOS shortcut that, while overly simplistic, actually works quite well to connect with Timewarrior!

Over the last year I’ve been using apps like timery and timelines to dabble with time tracking. Both of these apps have been great, and I highly recommend both of them. However…

Equally, I’ve been lured back into experimenting with text-based apps this year, after I fell once again to the infamous siren song of Emacs. To cut to the chase, I haven’t been able to get Timewarrior out of my head.

Desiring Timewarrior

Timewarrior, based on the great CLI task management app Taskwarrior, is also a simple CLI app, but focused on time tracking. I’ve been eyeing it for some time but have never fully tried it. On occasion I’d clock projects while at my computer, but I also wanted to track house tasks or projects… times when I usually only have my phone on me. I know there are different Timewarrior servers and potential clients I could dive into, but that was more of a lift than I wanted to dedicate time to before I knew if the system even worked for me.

The Setup

Earlier this week I decided to use Timewarrior to track my computer projects, if only for a day. To simplify logging my time regardless of whether I was working on my MacBook or NixOS computer, I decided to actually use Timewarrior on diglet, my tiny Intel N100-based computer we use as a home server.

Terminal Computers

I started out by just using an open terminal window with a persistent ssh/mosh connection which I could enter timew commands into. It worked fine, but I quickly got annoyed with having to switch windows (often on a different workspace) to enter the commands, when I was already working in a perfectly capable terminal. Eventually, I switched to passing my queries over ssh:

ssh diglet.local timew summary :today

With that method working, I decided to abstract some of the repetitive parts, and added this alias to my zsh.nix config file:

twdl = "ssh diglet.local timew"; # Local only

With that alias saved and applied to all my computers’ zsh configurations, I could now type twdl <timewarrior commands>, and the command would execute on diglet via ssh, from my device just as if I was using Timewarrior locally.

Note: the shorthand twdl stands for “Timewarrior diglet local” 😉

My Phone

An Apple Shortcuts window open on the Mac, showing 3 simple steps
The shortcut was easy to configure, at least for a basic setup.

When I finished up my computing tasks for the day, I wanted to continue logging with Timewarrior, but away from my computers. Passing commands over ssh worked so seamlessly that I was sure I could set up something similar for my iPhone using Apple Shortcuts.

There was only one “problem”… my ssh setup relied on being connected to my home network. However, when I want to track time from my phone, it is often when I am out and about. Luckily, this wasn’t a real issue, as I already have Tailscale configured and running on both my iPhone and diglet.

I fired up the Shortcuts app and got to work. I started with getting the ‘Run script over SSH’ step working, as it was the most complicated and critical one. I set up the host using my diglet login and its Tailscale address. For the script part, I started with a hard-coded timew summary until I confirmed the ssh commands were working.

With the ssh section working, I moved on to adding a few extra steps to make a basic but flexible shortcut. First, I added a starting prompt that asks the user what timew commands to execute. I saved that input to a variable, which I then passed to the ssh step: e.g., timew $VAR.

Next, I knew from running timew commands over ssh on the computer that the output is still returned. At first, I just displayed it in a text window, but it was too hard to read. I debated formatting the output, but it seemed like more effort than I wanted, and likely less flexible across commands. After a quick search, I learned that shell output displays more nicely when using ‘Quick Look’. Good enough.

For ease of use, I bound the shortcut to the action button on my iPhone 17. Now all I have to do is hold the button for a second, and a window pops up to prompt me for Timewarrior commands (I don’t have to write the timew part). I enter it, and then see the result on screen. That’s it. Simple, easy.

Conclusion

I’ve been using this for my time tracking throughout the week and honestly… it works really well. At this point, the biggest issue I face is that I’m not familiar with the more advanced Timewarrior commands… yet. There are more advanced ways to manage what I’m doing, and I could configure a proper server/client, but this works great. The one thing I might do is add additional options to the shortcut prompt to single-tap my most frequent commands, but still leave the custom input at the bottom.

For now, I’m happy as is. Sometimes the best solution isn’t the fanciest one, but one that is simple and works.

- Back to Post Index -