Using i3status to show Current Task

Created on 2020-11-28T00:39:08-06:00

Return to the Index

This card can also be read via Gemini.

~/.config/i3status/config

general {
       output_format = "i3bar"
       colors = true
       interval = 5
}

order += "read_file task"
order += "memory"
order += "tztime local"

tztime local {
       format = "%Y-%m-%d %H:%M:%S"
}

memory {
       format = "%used"
       threshold_degraded = "10%"
       format_degraded = "MEMORY: %free"
}

read_file task {
    path = "/tmp/current-task"
}

Now you need a hook to write every time you call task:

~/.task/hooks/on-exit

#!/bin/fish

if test -e /tmp/tasking
    exit
end

touch /tmp/tasking
set most_urgent_desc (task rc.verbose: rc.report.next.columns:description rc.report.next.labels:1 limit:1 next)
set most_urgent_id (task rc.verbose: rc.report.next.columns:id rc.report.next.labels:1 limit:1 next)
echo "$most_urgent_id" > /tmp/current-task-id
echo "$most_urgent_desc" > /tmp/current-task
rm /tmp/tasking

It is important to use a lock file otherwise calls to task used by this script will in turn call the hook again, resulting in a fork bomb.