[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Todo Lists in TaskWarrior

Taskwarrior is a powerful command-line todo list manager which can be installed from SlackBuilds.org. Please note that it depends on Lua.

Managing Your Todo List

You can use TaskWarrior in 2 ways:

1. By invoking the Task Shell and issuing TW commands:

% task shell
task 2.1.1 shell

Enter any task command (such as 'list'), or hit 'Enter'.
There is no need to include the 'task' command itself.
Enter 'quit' (or 'bye', 'exit') to end the session.

task>

2. By typing TW commands directly from a system shell (eg. Bash) preceded with the task command. This is the approach we are going to take in this tutorial. In order to limit the amount of typing we could create a shell alias. If you use Bash, please edit (or create) the following file ${HOME}/.bashrc:

/${HOME}/.bashrc
alias t=task

In this HOWTO we are going to use the full task command.

Adding Tasks

% task add Email Bob    
Created task 1.
% task add priority:H Book a ticket
Created task 2.

We have just created 2 tasks with the second one being of high priority.

Adding Due Dates

% task 1 modify due:09/09/2012
% task 4 modify due:today
% task 5 modify due:3days

Displaying Tasks

% task

ID Project Pri Due        A Age Urgency Description  
 2         H                            Book a ticket
 1             09/09/2012               Email Bob    

2 tasks

Please note that because of high priority, task 2 is at the top of the list. There are a few ways you can list your tasks: * task * task minimal * task ls * task list * task long

Each method differs in terms of the amount of displayed information.

Starting a Task

% task 1 start

Marking Tasks as Done

% task 2 done
Completed task 2 'Book a ticket'.
Completed 1 task.
% task ls

ID Project Pri Description
 1             Email Bob

1 task

Deleting Tasks

% task 1 delete

Alternatively, you can undo the task you've just created:

% task undo

Duplicating Tasks

We have got the following task:

ID Project Pri Due A Age Urgency Description     
 4         H          3s       6 Phone Lennart about the code

You can duplicate the task with some modifications

% task 4 duplicate /Lennart/Linus/
ID Project Pri Due A Age Urgency Description     
 4         H          1m       6 Phone Lennart about the code
 5         H          7s       6 Phone Linus about the code

Modifying Tasks

You have just realised that one of your tasks contains a spelling mistake:

ID Project Pri Due A Age Urgency Description                  
...
 6                   16s       0 Install Slakware on the lappy

We can modify an existing task:

% task 6 modify /Slakware/Slackware/g
ID Project Pri Due A Age Urgency Description                               
 4         H         14m       6 Phone Lennart about the code              
 5         H         14m       6 Phone Linus about the code                
 1                   43m       0 Email Bob
 2                   33m       0 Install Opera                             
 3                   31m       0 Upgrade Angband
 6                   12m       0 Install Slackware on the lappy            
 7                    6m       0 Create a SlackBuild for my new program
 8                    4m       0 Buy a present for Billy                   
 9                    4m       0 Test my SlackBuilds on Slackware 14
10                    2m       0 Feed the dog                              
11                    2m       0 Change my email address on SlackBuilds.org
12                   28s       0 Tax Return                                
13                    1s       0 Upgrade SlackBuilds
% task 1-6 modify project:misc   
% task 7,9,11,13 modify project:SB
% task 8,10 modify project:home
ID Project Pri Due A Age Urgency Description                               
13 SB      H         13m       7 Upgrade SlackBuilds                       
10 home    H         16m       7 Feed the dog                              
 4 misc    H         28m       7 Phone Lennart about the code              
 5 misc    H         28m       7 Phone Linus about the code                
12         H         14m       6 Tax Return                                
 9 SB      M         18m     4.9 Test my SlackBuilds on Slackware 14       
11 SB      M         16m     4.9 Change my email address on SlackBuilds.org
 8 home    M         18m     4.9 Buy a present for Billy                   
 1 misc    M         57m     4.9 Email Bob                                 
 6 misc    M         26m     4.9 Install Slackware on the lappy            
 7 SB      L         20m     2.8 Create a SlackBuild for my new program    
 2 misc    L         47m     2.8 Install Opera                             
 3 misc    L         44m     2.8 Upgrade Angband                           

13 tasks

You can display a breakdown of your projects:

% task projects

Project Tasks Pri:None Pri:L Pri:M Pri:H
(none)      1        0     0     0     1
SB          4        0     1     2     1
home        2        0     0     1     1
misc        6        0     2     2     2

3 projects (13 tasks)

Adding / Removing Tags

You can add tags by:

% task 3,5,7-10 modify +work

You can remove tags by:

% task 7 modify -work
Please note that tags are only displayed when you list your tasks with the long option.

Selective Display of Tasks

Display your tasks by priority:

% task priority:H
[task next priority:H]

ID Project Pri Due A Age Urgency Description                 
13 SB      H         15m       7 Upgrade SlackBuilds         
10 home    H         18m       7 Feed the dog                
 4 misc    H         30m       7 Phone Lennart about the code
 5 misc    H         30m       7 Phone Linus about the code  
12         H         16m       6 Tax Return                  

5 tasks

Display your tasks by project:

% task project:SB
[task next project:SB]

ID Project Pri Due A Age Urgency Description                               
13 SB      H         16m       7 Upgrade SlackBuilds                       
 9 SB      M         20m     4.9 Test my SlackBuilds on Slackware 14       
11 SB      M         18m     4.9 Change my email address on SlackBuilds.org
 7 SB      L         22m     2.8 Create a SlackBuild for my new program    

4 tasks

Display your tasks by tag:

% task +work

Adding annotations

You can annotate a task:

% task 9 annotate i3 builds fine
ID Project Pri Due A Age Urgency Description                               
...
 9 SB      M          1h     5.8 Test my SlackBuilds on Slackware 14       
                                   9/1/2012 yajl works fine                
                                   9/3/2012 i3 builds fine                 
...

Displaying Statistics

% task stats

Colours in TaskWarrior

You can enable one of the colour themes in ~/.taskrc by uncommenting one of the lines:

/${HOME}/.taskrc
# Color theme (uncomment one to use)
#include /usr/share/doc/task/rc/light-16.theme
#include /usr/share/doc/task/rc/light-256.theme
#include /usr/share/doc/task/rc/dark-16.theme
#include /usr/share/doc/task/rc/dark-256.theme
#include /usr/share/doc/task/rc/dark-red-256.theme
include /usr/share/doc/task/rc/dark-green-256.theme
#include /usr/share/doc/task/rc/dark-blue-256.theme
#include /usr/share/doc/task/rc/dark-violets-256.theme
#include /usr/share/doc/task/rc/dark-yellow-green.theme
#include /usr/share/doc/task/rc/dark-gray-256.theme

The dark-green-256 theme looks as follows:  TaskWarrior

You can display current colours (variables + colour values) with:

% task color legend

Colour themes can be easily customised by editing theme files. All the theme files are located in /usr/share/doc/task/rc/.

Displaying a Calendar

All the tasks that have a due date assigned will be marked on the calendar. Additionally you can enable the display of holidays by specifying a country in ~/.taskrc:

/${HOME}/.taskrc
include /usr/local/share/doc/task/rc/holidays-GB.rc

The /usr/share/doc/task/rc/ directory contains holidays for other countries as well.

TaskWarrior Integration

TaskWarrior is a very flexible and powerful tool. What makes it even more useful is the possibility of integrating it into your working environment.

TaskWarrior and i3

1. You issue TaskWarrior commands from dmenu. Simply press Alt+D and start typing a TW command, eg:

task add priority:H due:2days Mom's birthday

2. Assign basic keybindings.

display_tasks.sh
#!/bin/sh
task ls
read -p "Press Enter to close the window."

~/.i3/config:

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

This will enable the floating mode for any window entitled taskwin. The Win+T combination will display the list of your tasks in a floating mode in the middle of the screen. The Win+Shift+D keybinding will mark your top task as completed (Please see configuring i3 modifier keys).

3. Displaying the top task in i3status.

Sources

 howtos:general_admin:taskwarrior ()