Automatically importing Task Warrior To-Dos in a note

I am new user of Obsidian.

During the last weekend, I played with Espanso & Task Warrior. I set up a way to integrate a list of the most urgent tasks from Task Warrior into the note I am editing (e.g. my daily note).
Note that this a one-way only synchronisation and it is meant for listing the most important To-Dos of my day.

  1. Add to your .taskrc the following lines:
report.simple.description='Simple list'

These add to Task Warrior a concise (custom) report. It can be invoked at a shell prompt by typing task simple. It displays all the tasks (like task next), sorted by their “urgency” (a feature where Task Warrior excels).

  1. Create a BASH script in your $HOME, as it follows, and call it
#!/usr/bin/env bash

# Specify the maximal number of tasks to display

# Uncomment the next line if you sync your Task db online:
#task sync > /dev/null 2>&1

items=$(task simple | tail -n +4 | head -n $NumTasks)

tmp=$(echo "$items" | wc -l)

echo -n "- [ ] "

for item in $items
  [[ "$count" -lt "$tmp" ]] && echo $item

This script prints on the standard output the list of tasks, after removing heading and footer of the output displayed in the “simple” list of tasks (max 10, in this example). Note that I rely on the automatic addition of - [ ] to any line following the very first one, typical of Markdown editors such as Obsidian’s.

  1. Add the following entry to your Espanso configuration:
  # Task Warrior display
  - trigger: ";task"
    #word: true
    replace: "{{output}}"
      - name: output
        type: shell
          cmd: ""
          trim: false

This adds a trigger to Espanso’s text expansion commands.

Now, while in the Obsidian editor, I can interactively type ;task to instantaneously insert a list of task and descriptions. An example of the final result is reported below:

- [ ] buy milk
- [ ] send a Xmas card to E.
- [ ] buy a rose for my wife
- [ ]

It can certainly be improved but I hope it can be a starting point for some experiment of other users.


That’s really interesting. I want the same with linux :wink:
And maybe some inspiration here :