Task integration into the i3 statusbar

Recently I have been playing with TaskWarrior which is a very powerful command line todo list manager. I’ve decided to integrate it with my i3 statusbar and enable key bindings for some basic list management.

Here’s a very basic sample of Task’s output:

[sycamorex]~% task ls

ID Project Pri Description
4         H   Create a blog post
1             Configure Mutt
2             id3 tags
3             Email Linus T.
5             zsh prompt

5 tasks

i3status bar configuration
I’ve added some customised code to the i3statusbar.conf file to display the most urgent task in the statusbar.

Please note that the LG line below might safely be removed as it’s responsible for printing they current keyboard layout.

i3status | while :
    read line
    echo "TODO:$(task ls | sed -n '4s/[[:blank:]]\+/ /pg' )\
| LG: $(setxkbmap -print | grep xkb_symbols | awk -F"+" '{print $2}') \
| $line" || exit 1

The above file will be executed from i3′s main config file ~/i3/config:

bar {
        status_command ~/.i3/i3status.sh


As you can see from the screenshot, it is task number 4. The H letter after the task number indicates that the task is of a high priority which results in it being displayed at the top.

Furthermore, you can use some keybindings to mark the task completed and therefore remove it from the status bar displaying another task in the queue.

bindsym $ms+Shift+D exec task $(task ls | awk 'NR==4  { print $1 }') done
bindsym $ms+t exec urxvt -title taskwin -e sh ~/.i3/display_tasks.sh
for_window [title="taskwin"] floating enable

As you can see, I have also created a keybinding (MS + t) to quickly view all my task in a floating window. It works similarly to i3′s idea of scratchpad and I might actually have used it here. Below is the contents of display_tasks.sh:

task ls
read -p "Press Enter to close the window."

It all works fine if you use a simple and linear structure of todo lists. If, on the other hand, they include a number of projects/categories with each of them having their own set of priorities, you could modify the task command. The following command will display the most urgent task from the “work” project/category.

task project:work ls | sed -n '4s/[[:blank:]]\+/ /pg'

A better approach would be to be able to switch between categories using keys but that’s not what I personally need.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>