http://www.mike.tl

ThinkAlert

ThinkAlert is a small Linux program for manipulating the ThinkLight LED on ThinkPad laptop computers.

About

Some ThinkPad models come with a small LED at the top of their display, called a ThinkLight. The intended purpose of this lamp is to illuminate the laptop keyboard while typing in a dark environment. The light can be switched on or off using a special key combination on the keyboard (Fn+PgUp on the ThinkPad X61s) or be controlled via software.

There are a number of applications available to blink the ThinkLight (many can be found here). Most make the ThinkLight blink as an alert for incoming messages, although some are purely for fun. ThinkAlert improves upon the simplest one, stupid little hack to blink the ThinkLight. It provides a very basic command line interface for user space programs to blink the light.

Features

ThinkAlert has some small improvements over the program it is based upon:

  1. It can be used to switch the ThinkLight on or off.
  2. The blink interval argument is optional.
  3. It allows you to specify different periods for the blink on/off states.
  4. It restores the light back to its initial state after blinking.
  5. It permanently drops root privileges as soon as possible.

Use

There are three ways to invoke ThinkAlert. The first way is to tell it how many times to blink, and (optionally) the period of blink on/off states in microseconds. This syntax is supported by the “stupid little hack” program when the interval argument is present.

$ thinkalert <times> [interval (µs)]

If you want to specify different periods for the blink on state and blink off state, you can use the slightly more complex syntax:

$ thinkalert <times> <on period (µs)> <off period (µs)>

Also, you can tell ThinkAlert just to turn the light on or off.

$ thinkalert <on|off>

The uses of ThinkAlert are limited only by your imagination! Well not quite, but you get the idea. Currently I invoke it using Mailbox Alert for Thunderbird.

Installing

Download the source code and compile it using the following command.

$ gcc -o thinkalert thinkalert.c

Now set the permissions and move it somewhere into your path:

# chown root:nogroup thinkalert
# chmod 4755 thinkalert
# mv thinkalert /usr/local/bin