JWM Window Manager

Simple and Light


JWM is a window manager for Linux users who demand an efficient GUI and are not afraid to fire up an editor to get it. If this sounds like the kind of tool you are looking for, read on to discover more about JWM.

By Hagen Höpfner

original photo: www.sxc.hu

If you install a major Linux distribution, you will probably get the KDE or GNOME desktop. But neither of the big guns is renowned for a frugal use of CPU and memory resources. If your system is short on power, you may be looking for an alternative.

One of your options is JWM (Joe's Window Manager) [1] . JWM (Figure 1) got its name from its developer, Joe Wingbermuehle. Joe made sure JWM does not rely on countless libraries, restricting dependencies to the X Window system only.

Figure 1: JWM is a versatile desktop that is easy on resources.

Installation

JWM does not provide any ready-to-run binary packages, but building JWM from the sources is very easy as there are very few requirements to fulfill. All you need is the gcc compiler, and the developer packages for libxpm and the GUI desktop. If you have Suse Linux 9.2, you will find the X header files in xorg-x11-devel. If you have a distribution based on the XFree86 package rather than Xorg, you will find the developer files in the Xfree86-devel package.

Unpack the source code from the project homepage and change to the directory this step creates, jwm-0.21. Then give the commands ./configure, make, and su -c "make install" to build the executable and copy it to /usr/local/bin.

The easiest way to launch JWM is to go to text mode and then type startx to switch to GUI mode. To make sure that JWM launches when you do so, add the following line:

exec /usr/local/bin/jwm

to the .xinitrc file in your home directory. If you use a GUI-based login manager such as KDM or GDM, you can add an entry for JWM to the login manager menu.

First Steps

The first time you launch JWM, you should at least have your own configuration file, which will need to include a menu entry for launching a terminal. The system global configuration is placed in the /usr/local/etc folder when you install JWM. Copy the system.jwmrc file to your home directory as .jwmrc. Then open the file in an editor and change the program name xwsh in line 7 to the name of your favorite terminal, that is xterm or konsole for example.

After completing these preparatory steps, you can launch a basic JWM configuration for the first time. At the bottom edge of the screen you will see a tray that includes a menu, a pager, a CPU load indicator, and a clock. Later on, JWM will display a list of active programs in the middle.

You might like to select the Terminal menu entry to launch the application you configured in your configuration file. The window decorations are reminiscent of FVWM [2]. The window title bar includes buttons for iconizing, maximizing, and closing the window. Also included is an icon on the left, which opens the window menu on right clicking.

Configuring the Menu

You can use the menu to move the window to another virtual desktop or send it to the background in the current window. If you prefer to do without a mouse, JWM supports keyboard shortcuts that are very reminiscent of the KDE shortcuts. For example, [Alt]+[Tab] toggles between the windows on the current desktop, and pressing [Alt]+[F4] closes an application.

You can edit the configuration file to modify JWM to suit your own preferences, as the standard configuration would probably only make JWM's developer happy. The first thing to do is to set up the menu to support the applications you have installed on your system.

The menu can contain submenus, program launchers, separating lines, and internal JWM calls. The internal JWM calls help you terminate JWM, for example. The current version does not support re-launching the window manager via the menu. When we selected an entry to try this, JWM crashed. Listing 1 is a simple example that results in the menu shown in Figure 2.

Figure 2: The start menu defined in Listing 1.
Listing 1: JWM Sample Menu
01 <RootMenu label="Start" icon="start.xpm">
02         <Program icon="konsole.xpm" label="xterm">xterm</Program>
03                 <Menu icon="folder.xpm" label="Internet">
04         <Program icon="mozilla.xpm" label="Firefox">firefox</Program>
05         <Program icon="mozilla-mail.xpm" label="Thunderbird">thunderbird</Program>
06         <Program icon="licq.xpm" label="Licq">licq</Program>
07         </Menu>
08         <Separator/>
09         <Restart icon="reload.xpm"/>
10         <Exit icon="exit.xpm"/>
11 </RootMenu>
12 <Icons>
13         <IconPath>$HOME/.jwm_pics</IconPath>
14 </Icons>

The first line tells JWM that the menu definition follows. The next line has an entry for launching an xterm. Besides the label displayed for the menu entry (label="xterm"), the line also specifies an icon - icon="konsole.xpm". To allow JWM to find the icon, the image file for the icon needs to be stored below the icon path, which is $HOME/.jwm_pics in this case. The window manager can only handle xpm-formatted graphics.

To use the icons you already have installed, you can call convert to convert the PNG icons below /usr/share/icons to the required format and store them below /home/username/.jwm_pics. The line with the <Separator/> string adds a separating line to the menu.

The sample listing also changes the label of the menu button, which started off as JWM. The label= "Start" entry in the menu definition changes the label to Start (Figure 3).

Figure 3: JWM with a modified start button in the tray.

Tray Dressing

You can use the entries between <Tray> and </Tray> in the .jwmrc file to modify the appearance, size, and color of the panel, as shown in Listing 2.

Listing 2: Tray configuration
01         <Tray autohide="false">
02                 <Font antialias="true">-adobe-helvetica-*-r-*-*-12-*-*-*-*-*-*-*</Font>
03                 <Width>500</Width> <!-- Tray width (Default 1024) -->
04                 <Height>20</Height> <!-- Tray height (Default 28) -->
05                 <Alignment>center</Alignment>
06                 <Foreground>black</Foreground>
07                 <Background>#DCDAD5</Background>
08                 <ActiveForeground>black</ActiveForeground>
09                 <ActiveBackground>#8899AA</ActiveBackground>
10         </Tray>

The autohide="false" definition in line 1 prevents the tray from disappearing into the background. You can change this behavior by specifying autohide="true" to automatically hide the tray, unless the mouse pointer happens to be at the bottom edge of the screen. Font sets the font type.

You can use the xfontsel tool to discover the fairly cryptic font names. Width defines the width (minimum 320), Height defines the height (minimum 8 point, maximum 128 point), and Alignment the vertical alignment of the tray, which can be left, center, or right.

If you set the width to 0, the tray will take up the whole width of the screen. The color values for the Foreground and Background colors can be input as hex values, as in HTML files, or by specifying the color names. The showrgb | less command tells you the names recognized by your system. The easiest way to find out the hex color values is to use a program such as kcolorchooser.

Desktop Convenience

By default, JWM allows the focus to follow the mouse cursor. If you prefer to click to shift the focus, replace sloppy with click in the following line

<FocusModel>sloppy</FocusModel>

If four virtual desktops are not enough for you, you can increase the number in the <DesktopCount>4</DesktopCount> line. Make sure you use a value between 1 and 8.

JWM defines a few keyboard shortcuts by default, however, you can add to the list by defining your own shortcuts. Place your keyboard shortcuts at the end of the .jwmrc file. To define a keyboard shortcut, you need an entry with the following syntax: <Key mask="Modifier" key="Taste">Aktion</Key>. The Modifiers include A for [Alt], C for [Ctrl] and S for [Shift]. A line with <Key mask="A" key="F4">close</Key> in .jwmrc will close a window when you press [Alt]+[F4].

To launch an application when you enter a keyboard shortcut, specify exec: as the action, followed by the program name. For example, the following line <Key mask="C" key="T">exec:xterm</Key> launches an xterm when you press [Ctrl]+[T].

Conclusions

JWM is a small footprint window manager with surprisingly convenient features. If you are not afraid of text-based configuration, you can easily set up JWM to reflect your preferences. As JWM is under active development, someone may already be working on the problem that occurred when we attempted to re-launch the manager via the menu entry. Watch for a new version with a solution to this problem at the JWM project website.

INFO
[1] JWM Homepage : http://joewing.net/programs/jwm/index.shtml
[2] FVWM homepage: http://www.fvwm.org/
[3] JWM configuration: http://joewing.net/programs/jwm/config.shtml
THE AUTHOR

Dr. Hagen Höpfner is an author and computer scientist who is a regular contributor to Linux Magazine. He currently serves as a lecturer in Computer science at the International University of Germany in Bruchsal, Germany.