More than a Whim

Tagged with Regular Expressions

What's your relation to your desktop environment? Are you basically a consumer, focused on customizing a market leader like KDE or GNOME? A project like Whim makes deeper involvement feasible.

There are plenty of reasons to use the market leaders, of course, and to make the best of them through their many customization options. If you're like most "Regular Expressions" readers, you have a Linux desktop "up" all day, and it only makes sense to get the most out of it.

A Lighter Touch

You can go even farther, though, than customization and configuration. Several desktop managers are even scriptable, that is, they allow general-purpose computations over the constructs of a desktop environment. You could set up colors for windows decorations that encode the project on which you're working or the day of the week--or both! Titlebar menus can incorporate behavior you define. Desktop state is available to be saved and restored on your command.

While several desktop managers have experimented with this kind of programmability, it's the basis for Whim's creation.




Easy programmability has made it feasible to pack Whim full of features, including:

  • responsiveness and speed;
  • multiple desktops;
  • an optional OpenGL compositing manager for desktop effects including transparency;
  • desktop applets;
  • UTF-8 support for window titles;
  • multiple layout policies;

and much more.

It's certainly pleasant for us to advertise Whim's virtues. There's a more important point to this column, though, than promotion of Whim: we hope to show readers how much is possible with a little clever scripting, even in a domain like end-user graphical-user interfaces (GUI), where performance is crucial.

Whim certainly succeeds with end users. In fact, it's embedded in commercially-successful products. Steve Redler, Founder of SR Technology, has put Whim to work, as he reported in a chat exchange, "in a [factory] order entry and order picking system where use of a mouse is optional." Redler's company builds special-purpose low-cost hardware in which he embeds "vertical-market" software to solve specialized problems. Any software toolkit he uses must demand only a minimum of memory, computing power, and energy costs. His order-entry workstations, for example, operate at freezing temperatures, and themselves require only 25 watts for LCD display, CPU, keyboard, and barcode scanner combined.

At the same time, one of Whim's delights is that it's fully portable, all the way from tiny little embedded devices that run food-processing factories, up to full-screen developer-class rigs, so Redler uses Whim on his own workstation. Just as most of what you learn with Linux is available for re-use on everything from mainframes to cellular telephones, Whim makes the most of your desktop experience over a wide range of displays and processors. When Redler has an idea for a new technique or convention, it's practical for him to try it out for a week of his own daily pointing and clicking; he doesn't have to confine himself to special-purpose test hardware to exercise his ideas.

Whim is also like Linux itself in being open-source, with all the advantages that brings in support and reliability. As Redler illustrates, for his client list, "management has been open to more progressive open source/Tcl/Linux solutions after seeing the disaster that is 'big name/high profile/proprietary' solutions."

Whim Supports Desktop Applets

Whim is part of a more inclusive megapkg open source project, a collection of Tcl extensions and miscellaneous code. The project has progressed over the years to include a variety of extensions used by Whim and other projects.

Whim provides a desktop applet layer that allows Tcl scripts to interact with Whim using a simple protocol for script evaluation. Applets can be started from a menu to enable features like desktop animations, tools for taking notes, and a variety of other features. Applet state is saved when Whim restarts or exits in a serialized format for restoration when Whim starts again.

Whim provides multiple virtual desktops. This allows users to run many GUI applications in a more organized fashion. Whim provides JPEG and PNG image support for desktop images with a convenient Desktop Settings applet. The desktop settings are saved between Whim sessions, and each desktop may have unique background images, and colors for window decorations. Cameron particularly likes virtual desktops, for example, when debugging difficult problems where it's an advantage to be able to switch between complex contexts: one desktop might show a "before" context, with different windows providing information about the states of a database, Web server, Web browser, application server, and so on, while a second desktop holds the "after".

Whim provides a console applet that can be used to interact with Whim and experiment. Each desktop background window is implemented as a canvas, with an associated path. Note that Tk's canvas is a powerful, high-performance drawing widget fast enough to have been used for years in specialized design and simulations products. Whim's reliance on canvas allows users to extend the root desktop with unique animations and widgets. Here's an example:



Whim builds in this console to support interactive history through standard mechanisms. The first command in the screenshot above asks, in effect, "what is the current desktop object?"

George has created an objstructure extension to provide a more structured interface to such features of Whim as its applets, as well as serialization of applet state. objstructure follows a prototype-based object style. It supports methods, dynamic callbacks, and traces for instance variables, and integrates nicely with the Tcl language.

The second command above, "$::current_desktop canvas" asks the current desktop object what the widget path is for the Tk canvas. The final and third command is used to create a button on the desktop. The screenshot below demonstrates the resulting display.

Future Plans

Whim's maintainers are considering possibilities of 3D integration. X.org developers have created the Composite extension that provides the ability to redirect windows to offscreen memory; this opens up possibilities within Whim for even more innovative user interface patterns, ones which previous generations of software were simply too slow to make practical. The existing whimcompmgr2 compositing manager uses OpenGL and Composite for 2D alpha blending, and spinning scaled rotation of destroyed windows. George has expressed an interest in using D. Richard Hipp's OpenGL canvas for Tk as a basis for future 3D work. While Hipp is best-known as the creator of award-winning SQLite, his interesting creations include graphical inventions that hold great promise for Whim.

George and Cameron previously collaborated on a profile of the OpenBSD leadership. George is an independent programmer with deep knowledge about graphics and algorithms who has released dozens of useful code projects, including Whim, to the programming community. George is also a developer for the X.org, Tcl, and Tk open source projects. His work on X.org has mostly focused on XQuartz, which is unrelated to Whim. Cameron is vice president of a consultancy, Phaseit, Inc., which specializes in high-reliability and high-performance applications managed by high-level languages, but contributed no code to Whim.

 

0