xroach ng

Let cockroaches take over your desktop!

Xroachng: what?

Xroach is a well-known vintage application for Unix systems, based on the X11 protocol. It shows cockroaches running over the desktop, optionally they can be killed by well-aimed mouse clicks. The original version is from J. T. Anderson, while the most recent version is available at github.

Like the vintage versions of Xsnow and Xpenguins, Xroach behaves not very well on modern desktop environments like Gnome and KDE: the roaches are running on the root window, behind the desktop.

After completing Xpenguins I decided to correct this behaviour of Xroach. I chose a new name for the new version (xroachng: Xroach next generation), because I was not able to contact the copyright holder to ask him for his view on the new version.

Xroachng is available here.


Using my experience with Xpenguins, it was not difficult to let the roaches run on a transparent click-through window in stead of the root window and to create a graphical menu.

More difficult was the implementation of squishing the roaches. In the original version, an extra window is defined as a sibling of the root window, and mouse clicks are grabbed from that window. By the way, this has the desirable or undesirable side-effect that mouse clicks are not intercepted by the root window, so a normal usage of the for example FVWM desktop is not possible when you are squishing the roaches. I was not able to use the same method in Gnome or KDE without deactivating the whole desktop, the running apps included.

The solution was surprisingly simple: use XQueryPointer to get the mouse position and the status of the buttons to determine if a mouse click occurs at the location of a roach. So, no need for an extra window.

No double buffering

Because the picture quality of the moving roaches is sufficient, no double buffering is applied in this program.

Have fun!