Open Source

Command line calendars and some little known uses for them

Why would you want to use a command line calendar? Marco Fioretti tells you how they can be used and what the benefits are.

Command line calendars read personal appointments and public events from plain text files and (at least) display them as lists or tables made of plain text, tabs, and white spaces inside terminal windows.

This was all you could get when command prompts were the only user interface available. But why are these tools still available as binary packages for modern Gnu/Linux distributions? A good part of the answer is: because they're still much more efficient, when you want to play certain tricks, than sophisticated graphical PIM managers like Kontact.

I'll now show you what these tricks may be by using my personal favourite program of this category, pal. Let's first see, however, what are its main features and way of working.

When you just invoke it at the command prompt, pal shows a plain view of (more or less) the current and next month, as shown in Figure A. You can change the number of lines shown (default is 5) through the -c option.

The current day is printed bold between @ signs. The events mentioned in all the calendars listed in $HOME/.pal/pal.conf are enclosed in letters or other predefined symbols. A perfect example of this feature is the fourth week of February in Figure A. Feb. 20th is a (U)SA holiday (President's Day), Feb. 21st a Christian event (Shrove Tuesday). When a day is listed in more than one calendar and pal doesn't have predefined priorities, as is the case with Feb. 22nd, that day appears between asterisks.

What I've just described is the static pal interface, but this program also has an interactive mode that is called with the -m option and looks like Figure B.

As pal itself tells you in that window, press [h] to see the available commands, or [q] to quit. You'll be able to move from day to day with the arrow keys. Pressing [a] lets you add an event to the current date by answering some simple questions. The result will be saved to the calendar file you select, in a very simple format. A personal calendar with only two birthdays (Ted's on Jan. 7th and Alice's on March 20th) would look like this:

  more ~/.pal/personal
  MM Personal
  00000107 Ted's birthday
  00000320 Alice's birthday
and modify the output of pal as shown in Figure C, with each of its dates surrounded by red Ms and their descriptions in the event list of the corresponding day.

Please note that this will happen only if you have added a line like this to your pal.conf file:

  file personal (red)

So, what can you do with pal?

Command line addicts (we're still a lot!) don't need any particular justification to use pal or similar programs on a daily basis. This program, however, can be very useful even if you use console terminals very little, or not at all.

The first reason for such an assertion is that pal can generate calendars in LaTex or HTML format.

Here is how to generate the PDF file of Figure D:
pal -p personal --latex > personal.latex ; pdflatex personal.latex

Replacing --latex with --html would generate an HTML version (very ugly by default, but easily modifiable with the right CSS stylesheet).

I know what you're thinking: why should you bother with this when you can create nice calendars with a few clicks in DigiKam, Gimp, and other free software tools? Easy! Because pal lets you generate many different calendars, each customized for a different friend or relative, almost automatically. All you have to do is run pal inside a shell script loop, using a different calendar file at each iteration. Adding different pictures to each calendar would require just another command in that same loop (I'll show you in detail how to do this in another post)!

Another big reason to manage your calendar with a program like pal is that it makes it very easy to always have your appointments in front of you, no matter what Linux environment or window manager you are using. Adding a pal invocation in your shell initialization file (e.g. ~/.bash_profile) will display your calendar in all the terminals you'll open. Alternatively, you may feed the output of pal to Gkrellm, Conky or any other system notification tool I described in this post last summer. In that way, you wouldn't even need to use the command line all the time to use pal: your calendar would always be in front of you in the Linux root window!

The third and final little known usage of pal and friends is a generalization of the second one. Have you realized that there's no need at all that the author and the reader(s) of one calendar file be the same person? One user can maintain the calendar for a whole group, and all the others will always see the last version in the background of their own desktops (even if each of them uses a different distribution!), as long as all their instances of pal fetch the same file (with the -p option).

Isn't this handy? Teachers, for example, may use this feature to never let their lab students forget when everybody's projects are due. Parents of teenagers, instead, may use the same trick to make all sorts of reminders and housekeeping turns much harder to ignore. Which is, if you'll excuse me, just what I am going to try now!

About

Marco Fioretti is a freelance writer and teacher whose work focuses on the impact of open digital technologies on education, ethics, civil rights, and environmental issues.

4 comments
mfioretti
mfioretti

beaverusiv, I agree word by word. CLI interfaces for Google+ and Facebook would be really useful. Material for future posts....

boucaria
boucaria

I had been after some "hebrew" fonts for some text work about 12 years back, and I lucked out and found an add-in that as well as adding the fonts ( plus some Sanskrit), I could use a Calendar on the holy day cycles ( this was on a different continent) and the calendar ran under a command line window, which looked great. Ah the days... Too much admin now.

beaverusiv
beaverusiv

I find I really like CLI programs, mainly because of the flexibility (especially if you can pipe to text file/script/another program so you can cater to your needs. I hate having to give up and do things the way other people think I should. I am still very much trying to find my feet when it comes to desktop flow in my new job and this and mpd will stay in my thoughts. Now I just need a Google+ cli :p

Editor's Picks