My Profile Photo

AndrewCz


Using liberty-minded opensource tools, and using them well


Working with todo.txt


Add todo.sh script to conky for backround, and spice it up a bit

TODO.txt-cli

You know that todo.txt in your $HOME dir?

Yeah, it’s about to become awesome. Let’s see what we can hack with this.

Install

Clone the repo from git, put the todo.sh into somewhere in your $PATH, and put a line in your .bashrc to source the todo_completion file in the git repo. I put both files into my ~/bin dir.

I also added some lines to my .bashrc:

alias todo="todo.sh -Pt" 
	# -P to hide Priority, -t to append dates to title upon generation
source ~/bin/todo_completion
complete -F _todo todo

Next, add a hidden .todo directory in your $HOME dir so that we can put the completed items and the report and the config file in there.

Config

To customize the config file, I had my $HOME dir to be the base dir where my todo.txt is stored, and have the Done File and the Report File to be put into the separate .todo dir.

I also changed the colors of what output was to what. For Solarized:

export PRI_A=$RED        # color for A priority
export PRI_B=$LIGHT_RED  # color for B priority
export PRI_C=$BROWN    # color for C priority
export PRI_D=$GREEN
export PRI_X=$LIGHT_CYAN    # color unless explicitly defined

# There is highlighting for tasks that have been done,
# but haven't been archived yet.
export COLOR_DONE=$LIGHT_GREEN

# There is highlighting for projects and contexts.
export COLOR_PROJECT=$CYAN
export COLOR_CONTEXT=$LIGHT_PURPLE

And lastly, make a done.txt and a report.txt file inside of your ~/.todo dir.

Running it

This is a breeze. RTFM as to how to use priorities, projects, and contexts. It’s quite ingenious how they have it set up. I’m really a fan.

Integration into Conky

Anyways, here comes the interesting part. Making it work with conky. Luckily, it comes with a writeup on just that. Luckily I don’t believe in luck.

To start out, let’s get it running in conky:

${exec todo.sh ls}

This will at least start it. Let me customize the items and come back to this.

Task Numbers Showing

So first off, the numbers of the tasks themselves are showing up in Conky. There’s no reason for this, because the task numbers are irrelevant unless I need to assign them something, and I can find that out by searching with todo list {searchquery}.

There’s no built in here to exclude task numbers. This will have to be done manually. For the time being, I will exclude that, as there are more pressing issues at hand. They are ugly though.

Color Showing

I had my ACSII color codes showing in my conky window. Not good. I figured out that in my actually conky file where I put the execute command, I needed to specify the execp command instead of exec which would then let me put those color codes and have conky interpret them as colors, not as literallys.

Unfortunately, now they’re not Solarized. So I had to make them so. In the ~/.todo/config-conky file that you’re instructed to make on the site, all of the color names I replaced with hex values from their solarized counterparts. Here’s a cheat sheet:

export BLACK='${color 073642}'
export RED='${color dc322f}'
export GREEN='${color 859900}'
export BROWN='${color b58900}'
export BLUE='${color 268bd2}'
export PURPLE='${color d33682}'
export CYAN='${color 2aa198}'
export LIGHT_GREY='${color eee8d5}'
export DARK_GREY='${color 002b36}'
export LIGHT_RED='${color cb4b16}'
export LIGHT_GREEN='${color 586e75}'
export YELLOW='${color 657b83}'
export LIGHT_BLUE='${color 839496}'
export LIGHT_PURPLE='${color 6c75c4}'
export LIGHT_CYAN='${color 93a1a1}'
export WHITE='${color fdf6e3}'
export DEFAULT='${color}'

That’ll get ya where you need to go. Don’t forget the last line though that states to source ~/.todo/config as well. Keeping well in mind that the color variables in that file are commented out.