Window managers -4- JWM (ENG)

This article has been originally published in Italian (here). Feedbacks on content and translation are appreciated. Contributions are welcome. The original article must be considered the reference in case of updates.
JWM is the acronym for “Joe’s Window Manager“: JWM has one developer, is feather-light and feature-rich at the same time.

In other words, JWM has been a nice find since the very first usage. I also took the chance to switch to the most recent Ubuntu release, Raring Ringtail (13.04), as base for installation.

JWM doesn’t even have an official logo but, if it had, it would surely be the character of an old Hanna & Barbera cartoon: the Atom Ant. This was the first picture that came to my mind, thinking how powerful yet small JWM is.


Installation

It’s the same old story: packages jwm and xorg are all you need. Yet, in Ubuntu and Debian repositories there is a quite old version (v2.1.0, released in 2011), that has been improved in the meantime by beta releases of branch 2.2 currently under development. These releases are available as source code from “snapshots” (archive .tar.bz2) or Github project pages.

jwm_install

JWM: installation from repositories

A good reason to deal with compiling the source code (see JWM: Setup) rather than easily installing from repos? In the latest snapshots you’ll find my Italian translation (that you probably don’t care about since you’re reading this post in English!). Oh, well, and even a few bugs less and after all compiling is not so bad as you were told in your childhood tales for young nerds.🙂 By the way, I have already done all the “trial and error” drill to give you all the details: have you got any excuse not to do what every Linux user MUST do at least once in his lifetime? What about all the fuss on openness and availability of code? come on, don’t make uncle Stallman cry and get on with it!

First you have to get latest release tarball (864 at the moment) in a dedicated folder and extract it:

$ mkdir jwm-src
$ cd jwm-src
$ wget http://joewing.net/projects/jwm/snapshots/jwm-current.tar.bz2
$ tar -xjvf jwm-current.tar.bz2
jwm_download_source

JWM: downloading source code

Then you have to install packages required for compiling, listed in the project page.

sticky_notes_128Note: As I got to understand after a bit of struggle, when a library is required for compiling, say libwhatever, actually its development counterpart has to be installed, libwhatever-dev.

So:

$ sudo apt-get install gcc make libjpeg-dev libpng-dev librsvg2-dev libcairo2-dev \
libxft2-dev libxpm-dev libxinerama-dev libxmu-dev libxext-dev gettext

I have split the command line to make it easier to read, but it has to be typed without new lines; of course you have to add to the bunch also xorg to start the graphical session.

jwm_pkgs_compile

JWM: required packages for compiling

Installation of gettext, not explicitly required, is however needed to process locale files, without those you will only get the default english locale. The only library among the suggested ones I have left out is libfribidi-dev for right-to-left writings support (Arab and Hebrew, for example).

Last but not least, here comes the infamous compiling of source code (and its installation) you’ve heard about:

$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
$ make
$ sudo make install

Command configure as typed above launches compiling with default options for supported features (icons .png/.xpm/.jpg, multimonitor with xinerama, etc…) according to available libraries and defines folders for later installation: the executable jwm will be in /usr/bin, configuration files /etc and files modified at runtime in /var.

jwm_esito_compilazione

JWM: result of compiling

Last step is to add the startup command

exec /usr/bin/jwm

to files ~/.xsession or ~/.Xinitrc, or even startx in ~/.profile; in the latter case JWM will start automatically after login. Path to jwm is different according to value of --prefix used at compile time (/usr/local/bin with default options, run ‘which jwm‘ to check). If you are installing the package from the repos, files ~/.xsession and ~/.Xinitrc will be modified as part of the installation process itself.


Desktop

Desktop at first start shows a a tray on bottom edge, holding the program menu (JWM), a “Show desktop” button (“_”), the pager, the task list, a dock (now empty), programs integrated in tray (xload) and the clock: more than you usually get from a “light” WM.

jwm_desktop_855

JWM: Desktop

As for Open-/Fluxbox, the program menu (of course labeled “JWM”) pops out at a left/middle mouse click on desktop, that doesn’t support icons. The orange/brownish is quite awful but, y’ know, it’s just a matter of personal taste…

Below the summary of installation (Raring minimal alone takes about 30MB RAM):

  • Used RAM [free -m]: 37 MB (including terminal ~ 4 MB)
  • Total space on disk [df -h]: 1.1 GB
  • Version of jwm [jwm -v]: vgit-856
  • Used kernel [uname -a]: 3.8.0.29-generic

Configuration

JWM is simple and essential: there is only one configuration file (using XML syntax) that, at installation time, is /etc/jwm/system.jwmrc. This file has to be copied in user’s home as .jwmrc:

$ cp /etc/jwm/system.jwmrc ~/.jwmrc

To make customization easier it’s better to split the different file sections or groups of options, identified by tags, into several smaller dedicated files, as many JWM-based distributions do. Contents of .jwmrc and of partial configuration files has to be enclosed within tags “<JWM>” (opening tag) and “</JWM>” (closing tag) to be recognized as valid:

<!--?xml version="1.0"-->
<JWM>
<-- Comment (optional) -->
<Option>Value</Option>
...
<Include>/path/to/fileconf</Include>
</JWM>

Each tag must be closed at the end of the corresponding section (or sub-section). tags <Include></Include> act as “pointers” to partial files to read the configuration parameters from.

symbol_errorWarning: the tag <StartupCommand> is used to (obviously) automatically start applications. If the commands are modified you will need a logout/login to have JWM read them again. That is a reasonable choice to avoid multiple instances of the same applications each time JWM is restarted.

One way to “slice” the main file could result in the creation of partial files for:

  • colors (window decorations cannot be changed) of interface elements (windows, tray, menu, etc.. marked by tags  WindowStyle, TrayStyle, MenuStyle, etc…);
  • number, geometry (rows * columns) and background of desktops (tag <Desktops>);
  • keyboard and mouse shortcuts (tag <Key>).

face_coolNote: I love these tiny icons, and that’s a fact. JWM developer (Joe Wingbermuehle) kindly replied to my mail, asking for a clarification on desktop switching behaviour. If you have more than one row of desktops (for example 4 desktops 2 rows * 2 columns), by design (it’s not a bug!!!) desktop switching with mousewheel (on desktop or pager) only occurs through desktops on the same row. To “jump” to upper/lower row(s) you will have to use shortcuts Alt+UP/DOWN (or click on pager). That’s the way Joe likes it!

Speaking about keyboard shortcuts, I find every useful to set some of them for frequently used programs for example

<Key mask="4" key="t">exec:lxterminal</Key>

that binds the “Windows key + t” to start a terminal.

tipSuggestion: one of the first options you will likely change is the “FocusModel“, that is the way a window becomes active (is “in focus”). With the default value “sloppy“, a window becomes active just when it is under the mouse pointer: changing the value to “click” a mouse click is needed, as it usually happens in other graphical environments.

Once all the modifications are done, you can run

$ jwm -p

to check if configuration files have errors, mainly tags left open that prevent the files to be parsed correctly. If everything is fine, the “Restart” item in the menu (or comnand jwm --restart) makes thw WM unsurprisingly, ehm…, restart and read again the configuration files.


Interesting features

jwm_traybutton

JWM: Tray buttons

The “tray” (panel, toolbar, however you name it…) is the “big thing” of JWM, mainly due to the “tray buttons”. First, there can be multiple trays (“ol’ Gnome 2.x” school) placed horizontally and vertically. Just add another section enclosed in the <Tray> tag, similar to the default one, to the configuration file. An additional tray might be used to hold launcher icons for preferred programs, thus avoiding one of the many third-party “docks” (choose your favourite…).

Tray buttons have several functions: they can show menus (yes, more than one!), minimize all windows (Show desktop) or act as quick launch buttons.

jwm_startbuttonButtons can be have both a label and an icon (and an optional descriptive pop-up). If you feel like regretting the past, you can indulge in a little nostalgic moment.

Better move on to multiple menus. Start by adding another <Rootmenu> section to the configuration file and fill it with the relevant items.

<RootMenu onroot="3">
<Program icon="terminal.png" label="XTerm">xterm</Program>
<Program icon="/usr/share/pixmaps/lxterminal.xpm" label="Lxterm">lxterminal</Program>
<Program icon="/usr/share/pixmaps/firefox.png" label="Firefox">firefox</Program>
</Rootmenu>

This new section is then the second one in the RootMenu list, that you can recall creating a tray button like this:

<TrayButton label="Ailoviù" icon="/path/to/file.png">root:2</TrayButton>
jwm_multimenu

JWM: multiple menus

This string “explains” to JWM that the tray button is used to show a menu (“root:2“) and namely #2 listed in the configuration file.

Pay attention (no icon this time ;-)) not to confuse the menu number (root:2) with option onroot="3" in tag Rootmenu.

This option refers to the mouse button to click on desktop (that is the “root window“) to show the menu (left button = 1; middle = 2; right = 3).

Let’s take a little care about some “visuals”. I didn’t spend much time customizing graphics, except fiddling with the relevant parameters (orangebrownish is still there!); colours and fonts apart, there is not so much to do. Title bar can’t be changed (no theming) while window elements can be styled by GTK themes: lxappearance or gtk-chtheme and you’re set.

The only customizable window elements are buttons, that can be replaced by .png/.xpm/.jpg icons. Default buttons have the same colour as title text. Tags <ButtonMin>, <ButtonMax>, <ButtonMaxActive>, <ButtonClose> are added outside the <WindowStyle> section.

<ButtonMin>/path/to/file.xpm</ButtonMin>

Another nice feature, that will make old KDE3 lovers happy, is the background setting per desktop.

jwm_desktops

JWM: multiple desktop backgrounds

Within tag <Desktops>, you can add sections <Desktop> (no “s”!) with settings for name (that shows in the pager) and background for each virtual desktop.

<Desktop name="First">
<Background type="image">/path/to/file/wallpaper.jpg</Background>
</Desktop>
<Desktop name="Second">
<Background type="solid">blue</Background>
</Desktop>
<Desktop name="Third">
<Background type="gradient">red:green</Background>
</Desktop>
<Desktop name="Fourth">
<Background type="tile">/path/to/file/pattern.png</Background>
</Desktop>

The last way to set the desktop is by executing a command, as seen for the “*box family” (fbsetbg, esetroot, nitrogen, your choice): <Background type="command">command</Background>

jwm_groups_oclock

JWM: oclock “transformed” by window options

Last but not least, an successful experiment with <Groups> options to have a nice clock on the desktop. No “widgets” or weird things like that: it’s just the classic oclock for which I defined a group with proper options.

The window for this program class is (as listed below) without borders, without title, shown on all desktops, not listed in tasklist and pager, placed on bottom layer (below all windows) and never getting focus.

Command line parameters do the rest to make it transparent and place it in the upper left corner of screen.

<Class>Clock</Class>
<Option>noborder</Option>
<Option>notitle</Option>
<Option>sticky</Option>
<Option>nolist</Option>
<Option>nopager</Option>
<Option>layer:below</Option>
<Option>nofocus</Option>

“Transformed” this way, you still notice the clock is a normal window just because you can still “snap” other windows on it.

jwm_transp_compton

JWM: trasparenze con compton

And, if you love transparencies, you can’t do without an external compositor such as compton, originated (fork of a fork!) from the long abandoned xcompmgr (dead and gone, forget it!).

Development of compton goes on, there a nice PPA and, as far as I could see, leads to good results. If you noticed the <Opacity> tag, the value held within is passed to the compositor to create the useless wonder of transparent windows and menus.

Well, why not?🙂 In my short tests it took less than 2 MB RAM, with little load on CPU when moving a window.


Distributions and further references

  • Puppy Linux: it is the most loyal JWM-based distro (pun intended :-)). On its support forums you can find suggestions and solutions on JWM usage. In addition Puppy, since JWM is its official WM, provides some graphical configuration tools (that is, you do not edit files “by hand”!).
  • Tiny Core Linux, SliTaz, Damn Small Linux: mini-distros respectively 10, 30 and 50 MB large for “more than old” PCs. The common point is an extremely low resources consumption, at the cost of old software and missing features. Although they might not be “for the masses”, these little penguins deserve a look at least to borrow some nice ideas for settings.

Research on Distrowatch provides a few more results.


Conclusions

JWM, as you probably understood, pleased me quite a lot: light, a little short on the graphic side but largely customizable. JWM packs lots of features in a tiny “box”, becoming extremely flexible. Compiling it from source excluding all options (and related -dev libraries) results in a process taking up merely 1.5 MB RAM (compared to the anyway meagre 5 MB of the “full optional”).

Once I had a PC, the oldest I can recall, that probably couldn’t run JWM: its operating system was DOS 6.0😀

JWM takes the first place together with Fluxbox (that has a couple of peculiar features) in my personal WMs ranking. The more I explore these alternatives to full blown DEs, the more I realize that the real reason of my choice is not a matter of eye-candy but of availability of user-friendly configuration tools. On my good KDE I recently turned off almost all visual effects, set up a very simple panel with a few launchers, system menu and tray: nothing I couldn’t replace with some of the third-party tools seen before (panels and docks). And yet, I cannot give up a comprehensive “system settings” panel, a ready-to-go distribution that fits almost all my needs right after installation. I wish I had a “spare” PC to play with, to understand if I feel like “switching” and making the most out of what I have learned until now, each time I wade through a window manager. But that’s another story.


Wanna know the next window manager falling into my clutches? I have no idea! I’ll pick something else from the list!

Informazioni su Man from Mars

https://extendedreality.wordpress.com/

  1. Pingback: Window managers -1- Introduction | Extended Reality

  2. Pingback: Window managers -5- 2bwm | Extended Reality

Dimmi che ne pensi o fai "Ciao ciao!" con la manina // Share your thoughts or just say "Hello!"

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger cliccano Mi Piace per questo: