Cygwin, Dropbox and todotxt.sh

This short ‘howto’ describes:

  • putting the home directory of Cygwin on Dropbox
  • making the todotxt.cfg work on all Windows(*) machines, regardless of the directory where your Dropbox is located.

(*) This only works on Windows Vista and higher.

Background
Since a month or so, I use the open source task management script todotxt of Gina Trapani. I am enthousiastic about the uses of this system, so I have spent some time optimizing it. Below is a description of a few hacks that I use.

Because the computers that I use daily are Windows based, I decided to install Cygwin so that I can deploy the original todotxt.sh bash-script. Running the todo system from the command line has a lot of advantages, like easier search and selection, tab completion, easier adding of todo’s, etc.

If you want to know how to set up todotxt.sh under Cygwin, please read this short manual. Here, I asume that the reader is already familiar with using todotxt.sh in this way.

Screenshot of Cygwin terminal with todo-list

Putting the Cygwin home directory on Dropbox
When your Cygwin home directory is replicated to all your Windows machines, so are all your Unix terminal programs settings. When, for instance, you have created some aliases by editing your .bashrc file, it is very nice to be able to use these on all your Cygwin-machines. The same goes for your .vimrc or even your history!

The script todotxt.sh is also located in your home-directory and when the home directory is replicated by Dropbox, you only have to upgrade your todotxt.sh installation once to keep all your Windows Cygwin machines up-to-date.

  1. Stop Cygwin
  2. Make a backup copy of the directory C:\Cygwin\home\{yourname} to a safe location.
  3. Move (not copy) the directory C:\Cygwin\home\{yourname} to your Dropbox. I have moved the home directory to the location {Dropbox}\settings\cygwinhome.
  4. Create a symbolic link to the Dropbox location with the utility mklink.

Below is an example.

mklink /d c:\cygwin\home\ton c:\Users\ton\Dropbox\settings\cygwinhome

This command creates a directory link with the name ‘ton’ (my username) that points to the cygwinhome-directory on your Dropbox. Of course, you should substitute ‘ton’ with your own Windows user name.

This function to create links is not available on Windows versions older than Vista.

Making the todotxt.cfg file roaming
I also use the Android-app Todotxt Touch and therefore, I would like to keep the location of the todo.txt file to the default. Therefore, I do not place my todo.txt file in my Cygwin home directory.

If you edit the todotxt.cfg file, the first lines may look like this:

# === EDIT FILE LOCATIONS BELOW ===

# Your todo.txt directory
export TODO_DIR="/cygdrive/c/users/ton/Dropbox/todo"
#export TODO_DIR=`dirname "$0"`

There can easily be a problem with this. On the family laptop, for instance, my username is ‘papa’ and my Dropbox is located on the path:
C:\Users\papa\Dropbox

and the todotxt.cfg configuration line would have to read:

# Your todo.txt directory
export TODO_DIR="/cygdrive/c/users/papa/Dropbox/todo"

Do you see the problem? If you want to be able to put your todotxt script and config file on a central location, there should be one uniform todo.txt directory that is also on Dropbox.

The solution? Another mklink hack. On the family laptop, I have used the following command:

mklink /d C:\dbtb C:\Users\papa\Dropbox

Now the top of my todotxt.cfg reads something like this:

# === EDIT FILE LOCATIONS BELOW ===

# Your todo.txt directory
export TODO_DIR="/cygdrive/c/dbtb/todo"
#export TODO_DIR=`dirname "$0"`

The trick here is that if you create the equivalent directory link on all your Windows machines (pointing to your various Dropbox locations), you can use the same todotxt.cfg on all of them.

I hope this helps you enjoy a centralised Cygwin home directory and roaming use of the excellent todotxt.sh!

2 Comments »

  1. somename said,

    July 23, 2012 at 6:52 pm

    1. Create “todo” directory in your home folder.
    2. export TODO_DIR=”~/todo”
    3. You are done!

    The “~/” is substituted with your home folder path automagically, so no mklink voodoo is required.

  2. Bill said,

    October 15, 2012 at 4:02 pm

    I wanted my todo.txt available via dropbox and beat on google for a while before I finally connected the dots. I simply installed cygwin on my pc, location of your choice. Then I modified my todo.cfg to point to my todo folder in Dropbox:
    export TODO_DIR=”/cygdrive/c/Dropbox/todo”

RSS feed for comments on this post · TrackBack URL

Leave a Comment