Tim Hentenaar's Blog

Sep 26, 2014 21:00

Keeping Track of Meetings with mutt + calcurse

Like a lot of people, the environment I work in is a bit too M$ Exchange-centric in terms of email, scheduling meetings, and those sorts of things (unfortunately.) Since I use mutt to tackle my day-to-day email tasks, dealing with meeting requests is a bit of a pain. As a general rule, I never accept meeting invitations, but I figured it would be nice to have the ability to view them, and add them to my calendar from mutt. Thus, I set about integrating a few things to make the process "just work."

Viewing Invitations

At first, I Googled a while to see what solutions others had come up with, and there are quite a few. I tried a Ruby script or two, a Perl script or two, and finally settled on a Python script which I updated to work with Python 3. It works quite nicely with the following ~/.mailcap entry:

text/calendar; python path-to-mutt-ics/src/main.py; copiousoutput

Now, mutt will display the invite in an easier-to-read fashion.

Calendar Integration

For keeping track of things, I discovered calcurse, a lightweight calendar app with a curses interface. So far, it meets my needs just fine. I wanted to integrate this with mutt in such a way that, with a macro, I would be able to automatically load the meeting invite into my calendar.

To that end, calcurse has a nice -i option for importing calendar files. However, in order for this all to work, you have to have a version of calcurse >= 4.0.0, or this patch.

The patch makes calcurse reload its configuration files anytime it receives SIGUSR1.

To provide integration for mutt, I wrote the following bash script (NOTE: requires uudeview):

Caveat: The only downside to this is that it assumes that the calendar file will be the last MIME attachment. That won't hold true for all cases I can imagine, but in this case it works fine. Since the attachments never have any attachments other than a body and the calendar file, and neither have a name, uudeview just names them "UNKNOWN.nnn" where n corresponds to the order in which they're found in the message.

Next, I added this mutt macro to my .muttrc:

macro index,pager ",m" ":unset wait_key\n |/path/to/add_to_calcurse.sh<enter><exit>"

Now, when viewing an invitation in the pager, or in the index, I can simply hit ",m" and the invitation will be automatically imported into calcurse. Calcurse will then reload its configuration files, and the meeting will be immediately available in my calendar.

Final Thoughts

It's worthwhile to point out that there's also wyrd which serves as a frontend for remind. Some people seem to like it, and it looks like it's got potential. I'm not really a fan of OCaml though, and my goal was to find the simplest tool I could that meets my needs. Otherwise I'd probably have given wyrd a longer look-at.