Mastering Taskwarrior

Get your audible task management system ready in just 15 minutes!

01Create a task with a due date

For this example, we'll create a task called "Attend meeting" that's due at 2 PM. You would create this task in Taskwarrior as follows:

$ task add "Attend meeting" due:2pm

Make sure you have set the due time correctly as per your system's time settings.

02Script to check for upcoming tasks

Next, we'll create a script that checks for tasks due within the next hour. If such tasks exist, the script will have your Mac read them out loud.

Create a new file named task_reminder.sh and open it in your preferred text editor. You could create this file in your home directory for simplicity.

Paste the following code into task_reminder.sh:

#!/bin/bash

# get the tasks due within the next hour
tasks=$(task +READY due.before:now+1h export | jq -r '.[].description')

if [ -n "$tasks" ]; then
  # if tasks exist, have Mac read them out
  say "You have the following tasks due within the next hour: $tasks"
fi

This script uses jq to parse the JSON output of the Taskwarrior command. If jq isn't installed on your system, you can install it using Homebrew with brew install jq.

Save the file and then make it executable with the following command:

$ chmod +x ~/task_reminder.sh

03Schedule the script

Now, we need to schedule this script to run periodically. One way to do this is using cron. Open your crontab file using the command crontab -e and add the following line:

$ */15 * * * * /Users/yourusername/task_reminder.sh

Replace yourusername with your actual username. This cron job will run task_reminder.sh every 15 minutes.

And that's it! Your Mac will now read out your tasks that are due within the next hour, every 15 minutes. Of course, this is a simple example, and there's much more you can do when you integrate Taskwarrior with the say command, like customizing voices or creating more complex reminders. But this should get you started.

Taskwarrior integrated with the 'say' command, offers a unique task management experience. Keep your tasks in check and always stay on top of your game. Stay tuned for the next hour's challenge!