Monday, February 16, 2009

Creating a Calendar in Linux

Today I found a great program called "pcal". It can create good looking postscript calendars. Most importantly, it can mark holidays in the postscript output if a 'date file' (normally named .calendar) is provided to it.

I created a holiday list in my .calendar file as follows (the * after the dates indicate a holiday):

8/1/09* "Muharram"
23/1/09* "Netaji's Birthday"
26/1/09* "Republic Day"
31/1/09* "Saraswati Puja"
10/3/09* "Fateh-Duaz-Duham"

and then used pcal as follows to generate a nice single a4 page calendar for 2009:

pcal -P a4 -o -E -f .calendar -g holiday -w 2009

'-P a4' generates output for A4 sheet,
'-o' names the output file,
'-E' lets pcal know that my "date file" has dates in European format,
'-f .calendar' tells pcal the name of my "date file",
'-g holidays' tells pcal to use a particular color (in my case the default grey) for holidays,
'-w' tells pcal to create a whole year calendar (i.e. a full year on a single page).

Saturday, February 14, 2009

Setting "SHMConfig" to "true" for synclient to work in recent Linux distros


1. You use a synaptics touchpad on your laptop/netbook.

2. You use a recent Linux distro (like Fedora 10) that comes with a
blank /etc/X11/xorg.conf.

3. You don't like the way your distro has configured your touchpad by
default. For example, you would like to get a middle click by
tapping the upper right corner of the touchpad.


To change the synaptics touchpad options at runtime (i.e. while the X
Server is running), you need to use the command line program
"synclient" (or graphical programs like gsynaptics, etc.).

I prefer the command line "synclient" because it allows me to tweak a
lot of things that gsynaptics does not allow me to.

For example, to get a middle click by tapping the upper right corner
of your touchpad, run synclient with the following option:

synclient TapButton2=2 RTCornerButton=2

Read the synclient manual page for more details. Do a 'synclient -l'
to get the current user settings.

In Ubuntu 8.10, synclient is provided by the package

In Fedora 10, synclient is provided by the package

But to get synclient working, you need to have the option "SHMConfig"
set as "true" in your options to Xorg. This was earlier done by adding
the line:

Option "SHMConfig" "on"

in your /etc/X11/xorg.conf file in the Synaptics InputDevice section.
Now that this file is being deprecated, you need to find out how you
can provide this option to Xorg. If you are on Fedora 10 like me
(maybe this is also the case in Ubuntu 8.10, Fedora 9, etc.), you can
put this option in a hal configuration file in /etc/hal/fdi/policy/

Using root privileges, create a file named say, synaptics.fdi, in
/etc/hal/fdi/policy/ using your favorite editor, and put the following

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<match key="info.capabilities" contains="input.touchpad">
<match key="info.product" contains="Synaptics TouchPad">
<merge key="input.x11_options.SHMConfig" type="string">true</merge>

Next, restart by using the command (as root):

/etc/init.d/haldaemon restart

(The above command is for Fedora users. Use hal instead of haldaemon
if you are on Ubuntu)

Next, restart X Server using the command:

killall -HUP Xorg

Once X Server restarts, you should be able to use synclient without
any problems.

For more information regarding Synaptics Touchpad configuration
and configuring other devices under Xorg, see