WindowMaker on PCLinuxOS - WindowMaker Internals Part 1

Patrick G Horneker (phorneker)

This article discusses command line utilities that WindowMaker uses to perform its magic on your desktop. In order to further explain WindowMaker's capabilities, it is necessary to explain the internal workings of the window manager. This will also help when it comes time to explain how to create themes for WindowMaker.

The actual programs that make up WindowMaker itself are where one would expect to find them, in /usr/bin.

Obviously, wmaker is the program that starts up WindowMaker itself. Like any window manager such as metacity (for GNOME), kwm (for KDE), or FVWM (now in the PCLinuxOS repository), wmaker is the main control program for the display of windows, menus, icons, docks, and the overall user experience that WindowMaker provides.

But there is more to WindowMaker than just wmaker. There are a number of supporting command line utilities and dock applications that are included with the WindowMaker package.

startwindowmaker is a script that launches all components of WindowMaker first, then wmaker itself. When you select WindowMaker from the Session menu at the login screen, this is the script that gets executed when WindowMaker is launched after you login to PCLinuxOS.

WindowMaker-Terminal, (or wterm), is WindowMaker’s equivalent to KDE’s Konsole, or GNOME’s Gnome Terminal. wterm does not have the customization features available on Konsole or GNOME Terminal, but it does give you a command line interface to your PCLinuxOS system..

getstyle can be used to save WindowMaker’s state for the appearance of windows (called display attributes), a component that is part of WindowMaker themes. setstyle is used to change the appearance of windows using a text file (containing the display attributes, usually saved with the getstyle command.) Typically, we would call getstyle and redirect the output to a file to save the current set of display attributes, for example:

getstyle >pclinuxos.style

I used the .style extension in this example so that anyone would know the contents of this file define a style that WindowMaker uses. Also, this is the official extension used by the developers of WindowMaker for their set of styles included in the default installation. For PCLinuxOS, these files are stored in /usr/share/WindowMaker/Styles and in /usr/share/WindowMaker/Themes.

The following is the default style as supplied with the PCLinuxOS implementation of WindowMaker.[a]

{
 LargeDisplayFont = "sans:pixelsize=80";
 HighlightColor = "#5b67b2";
 MenuTextExtendSpace = "-1";
 FTitleColor = "#eeeeee";
 MenuTitleExtendSpace = "-1";
 MenuTextFont = "sans:pixelsize=12";
 UTitleBack = (mdgradient, "#e9eae9", "#e0e1e0", "#dbdcdb");
 IconTitleFont = "sans:pixelsize=10";
 PTitleBack = (mdgradient, "#000000", "#8c8c8c", "#aaaaaa");
 WindowTitleFont = "sans:bold:pixelsize=10";
 UTitleColor = "#000000";
 MenuDisabledColor = "#a4a4a4";
 ClipTitleFont = "sans:bold:pixelsize=10";
 MenuStyle = flat;
 MenuTextBack = (solid, "#e6e7e6");
 PTitleColor = "#000000";
 IconBack = (mdgradient, blue, "#bfbfbf", "#e6e7e6");
 MenuTitleBack = (mdgradient, "#5772b4", "#415faa", "#2b4da0");
 DisplayFont = "sans:pixelsize=10";
 FTitleBack = (mvgradient, "#5772b4", "#415faa", "#2b4da0");
 WindowTitleExtendSpace = "-1";
 TitleJustify = right;
 CClipTitleColor = "#a4a4a4";
 ResizebarBack = (solid, "#8c8c8c");
 MenuTextColor = "#000000";
 ClipTitleColor = "#000000";
 IconTitleBack = "#2b4da0";
 HighlightTextColor = "#ffffff";
 IconTitleColor = "#ffffff";
 MenuTitleFont = "sans:bold:pixelsize=10";
 MenuTitleColor = "#eeeeee";
}


wkdemenu.pl is a Perl script that reads in the current menu configuration from the KDE desktop. The PCLinuxOS implementation of WindowMaker uses this script to get a list of applications to create the user menu. It accomplishes this by setting up an external menu which is called to retrieve the listing of applications available in the KDE installation. Then, any additional applications it finds will be inserted into separate menu entries. Warning: The script itself has not been updated since September 2001!!!

The current version of WindowMaker has been 0.92 since 2008. Unfortunately, wkdemenu.pl implements the user menu in a format that is compatible with versions earlier than 0.90.

While WindowMaker can use menus in the older format, converting the generated menu to the new format using wm-oldmenu2new will prevent PCLinuxOS from updating the menu when software is added to or removed from the system using Synaptic. You may use wm-oldmenu2new if you wish to manually edit the WindowMaker system menu when you add or remove software with Synaptic. This utility is used by the WindowMaker Configuration Utility and by WindowMaker Preferences (Prefs.app).

wmCalClock is a 64x64 pixel application that displays the date and time in the WindowMaker dock. It is located directly below the Dock icon. This application starts when you launch WindowMaker.

wmagnify is a WindowMaker application that magnifies a small portion of the display where the mouse pointer is at. This is an accessibility tool provided with WindowMaker.

wmaker.inst is executed when WindowMaker is run for the first time.  This initializes the GNUStep/WindowMaker directory in your home directory where your personal preferences are stored (as well as your custom backgrounds and themes).

wmsetbg is a command line utility that sets the background on your current workspace. Of course, you will need to supply various options with this utility, depending upon the type of background you wish to set. wmsetbg is typically called with a set of common options.

-a or --maxscale scales the specified image preserving its aspect ratio. This could result in part of the background color showing where the image does not cover the screen.
-b or --back-color sets the specified color and if an image or another color is used, the color becomes part of a texture implemented with the background.
-e or --center centers the image specified in the command line.
-t or --tile tiles the image specified in the command line.
Note: -e and -t should not be combined. It really does not make much sense.
-s or --scale scales the specified image. This can be combined with either -e or -t.
-d or --dither dithers colors. At least two colors must be specified with this option.
-w or --workspace selects which workspace to change the background.

The -t, -e, -s and -a options require a filename for the image you want to use as a background.
The -b and -d options require that at least one color be specified in either a UNIX recognized color name (which is the same as the color names used within HTML tags, and on CSS stylesheets), the “#RRGGBB” format (quotes included here), or “rgb:RR/GG/BB” (quotes included here also) where RR, GG, and BB are hexadecimal values.

For example, wmsetbg -b “#7f7f7f” or wmsetbg -b “grey50” will set a 50 percent grey background in the current workspace.

Likewise, wmsetbg -e -s mybackground.jpg will fill the background with whatever picture is in mybackground.jpg.

There are other command line utilities provided with the PCLinuxOS implementation. These are typically called from applications written specifically for WindowMaker, and are not directly called from a command line. Some of these applications are downloadable from Synaptic, while others are available from http://www.dockapps.org. Typically, these applications have names that begin with “wm” (for WindowMaker), and you can find them by searching “windowmaker” from within Synaptic.[b]
 
The getstyle and setstyle commands use a text file containing display attributes, or properties that are used by WindowMaker to display windows, icons, menus, the Dock and Clip, and the background of each Workspace on your desktop.

Notice that the overall text file generated by the getstyle command is in a format similar to a CSS stylesheet or a fragment of code in a language such as C, C++, Java or Python. This format is called a Property List in WindowMaker terms. Property Lists are one of the core components of WindowMaker itself, and the developers of WindowMaker created a separate library and API package for that purpose (called libPropList, and that package is available in the PCLinuxOS repositories). Though it is not required for WindowMaker itself, you will need the libWindowMaker-devel, libPropList and libPropList-devel packages if you wish to develop applications for WindowMaker with PCLinuxOS.

This display attributes file is an example of a Property List used to configure your WindowMaker desktop. Each attribute has at least one parameter which must be set.

Color parameters are notated as “#RRGGBB”, “rgb:RR/GG/BB” or a named color as described for the wmsetbg command.

Font parameters are notated as “name:attribute:pixelsize=size” where name is the name of the font, and size is the font size in pixels. Quotes are included with the parameter so be sure you include them. sans means the generic sans-serif font, which is the default font for the PCLinuxOS implementation, and it is used if WindowMaker cannot find the font you request. The font size is expressed in pixels rather than points. This is because computer displays are measured in pixels on the screen rather than points on the printed page. attribute is optional, and does not need to be included if you are using the normal variant of the font. If you wish to use a bold font, for example, a bold sans-serif font, you would notate the font as “name:bold:pixelsize=size”. For an italic font, you would notate the font as “name:italic:pixelsize=size”.

You can also give WindowMaker a choice of fonts to use. For name, use a comma separated list of fonts that WindowMaker can use in order from first choice to an “if all else fails” choice.

If you have ever programmed in a functional language such as LISP or SCHEME, you will notice that the parameters in a Property List are either constant, quoted values, or a list of parameters enclosed within parentheses. This is because some of the display attributes in the generated text file require multiple parameters to be set at once. Fortunately, these parameters are also set when you use either the WindowMaker Configuration Manager (wmakerconf) or the WindowMaker Preferences utility (Prefs.app).