Finally, a Calendar that Works
It’s such a tiny thing but it’s been bothering me for about 5 years now. I need a calendaring solution for Linux. My needs are very basic:
- I want it integrated with my mail. 99% of my scheduling needs are meetings that I’ve been “invited” to via email. Launching or switching to a separate for that is annoying. Also, when the meeting arrives, I’d like to have the agenda/location right there (or at least some hint of which email I should look that up in) and not have to copy it from the original email.
- Simple to use. Having to click a bunch of tiny buttons to set the exact start time of the meeting, having to change a bad default date, having to decline to “invite” other participants, etc is annoying. Just let me type in a time! And possibly a day!
- When the scheduled item is due, I need it to alert me asynchronously. I.e. don’t play a sound, because I might not be at my desk. Pop up a window or something that I’ll find when I return. (One previous calender did pop-unders which I don’t even.)
Yesterday, I was about to ask around for what other people were doing and I was trying to compose the query include CLI-friendly tools but not at. I was having trouble and finally thought “maybe that’s because at is a good solution”. It turns out it is!
But at performs arbitrary actions. I need an action to perform. That’s where notify-send comes in. (By far the longest part of setting up this system was getting notify-send working. Turns out that Ubuntu has messed it up by replacing the back-end notification-daemon with notify-osd which sucks in multiple dimensions. sudo apt-get remove notify-osd && apt-get install notification-daemon fixes that.)
The final piece of the puzzle is that my mail client is sup which, like some other mail clients, let’s me pipe a message to a shell command.
#!/bin/bash
icon=/usr/share/icons/gnome/scalable/actions/appointment.svg
msg=`sed -n 's/^Subject:\(.*\)/\1/p' < /dev/stdin`
timestr=$@
export DISPLAY=`hostname`:0.0
echo notify-send -t 0 "reminder" \"$msg\" | at $timestr
(at runs a shell that doesn't have $DISPLAY set, so that's why that's there.) I've saved this in ~/bin/remind.sh. Now here's the order of events:
- I get an email that says "Your gracious presence is humbly requested at 9:45 on Friday 6 August, 2010.
- I type | remind.sh 9:45 friday to pipe the email to my script along with the day/time.
- The script automatically strips the Subject: out of the message and schedules a notify-send for the given time.
- At the appointed time, a notification pops up on my screen (on all virtual desktops too, btw) that doesn't disappear until I click it.
