Getting older, not necessarily wiser!
The first thing we need to do is get a handle on is the .jwmrc configuration file we created in our home directory. We need to organize it, mainly to make it easier to edit. There are three parts to making the configuration file easier to edit; control white space, add comments, and manage sectionalization.
The white space and commenting parts is fairly straight forward. However sectionalization will depend on your specific desires and needs. It involves organizing the various configuration topics in a logical order that make items easy for you to find. This can be done in a single monolithic configuration file or multiple smaller configuration files.
Any jwm configuration file will be written in the Extensible Markup language (XML). The language consists of nested pairs of markup tags, a beginning tag and an ending tag. Writing XML, you do not need carriage returns, line feeds, tabs, or spaces. These items are collectively referred to as white space, and are ignored by whatever mechanism is being used to read the file.
However an XML file would be extremely hard to manually read without them. Therefore we use these characters to make our file more legible. A prime example is indenting the contents between starting and ending tags to make the structure of the document stand out. For example;
<Group> <Name> xterm </Name> <Option> vmax </Option> </Group>
Here the main tag is the Group tag. Note that the ending tag includes the “/” character. The Name tag is a sub-tag of Group, and xterm is the actual value of the tag/sub-tag combination. The same can be said for the Option tag. So the Group tag has two value pairs; Name = xterm and Option = vmax.
Note that if the tag group is short enough it can be on one line. For example it is also correct to write <Name>xterm</Name>.
Generally, I have found the jwm configuration file included with Arch to be very well laid out with regard to white space. This is not the case with every Linux Distribution. I can remember taking half hour or more to clean up the jwm configuration file that came with Debian, before doing anything else with it.
Something I always harp on when coding is adding comments. I hate coming back to something I worked on many months in the past, and having to spend time figuring out what I was trying to do.
Since XML files are plain text, adding lots of comments is not going to break the bank, file size wise. So use lots.
A comment in XML looks like this.
<!-- This is a comment -->
You can also span multiple lines between the opening and closing (<!– and –>) of a comment.
<!-- This is an example of a multi line comment -->
Not much more to say on comments, other than use them!
This is where things can get a little fuzzy and personal preference comes into play. For the jwm program, it really makes no difference where configuration options are placed in the configuration file. However when we humans are working with the file, it is generally considered better to organize and gorp items for more efficient editing.
My personal preference is to sensationalize by function. For example I generally have five sections; system, function, style, binding, and other. This does separates the configuration of some items between multiple sections.
For instance tray style and tray settings are going to be in different sections. However I fond that when I work on configuration and change a style setting, I am usually changing lots of style settings and it is handy to have them grouped together.
As stated, this is going to be a personal preference. As we get into editing the configuration file, you may find you access some items in a specific order most of the time. It could speed up your work flow to organize them in that order.
Unlike my previous series of posts on configuring jwm in Debian (using a single file). This time around, in Arch, I am going to use multiple smaller configuration files.
An Include tag can be placed anywhere in a configuration file. In between the include tags will be the address of what to include. For example;
<Include> /home/user/.config/jwm/test-jwm.cfg </Include>
Note that if the “exec” command is added, this implies running a program. In this case the output of the program is what is included. An example of this would be an automatic menu generation program (would have to output jwm comparable configuration information).
What I am going to describe is my approach to this project. It is an example, do not take it as the only way to do it.
If I make hidden files visible in my home directory, I will see a folder called .config. This looks like a good spot to place my multiple jwm configuration files. I will still be calling them from the hidden .jwmrc file at the root of my home directory, but it will become a much shorter file than it is now.
You can modify your jwm configuration files from either the file manager or the terminal. I will be listing the terminal commands in this post.
Create a jwm folder within the .config folder.
Create my jwm configuration files.
cd ~/.config/jwm touch system.jwm function.jwm style.jwm binding.jwm other.jwm
Copy/rename the .jwmrc file to a default file in my jwm configuration directory (allowing me to do the configuration in stages rather than all at once.
cp ~/.jwmrc ~/.config/jwm/default.jwm
Finally I open my .jwmrc file and delete almost everything, then add an Include tag for the /home/user/.config/jwm/default.jwm file. When finished the file content should look like this.
<?xml version=”1.0” ?> <jwm> <Include>/home/user/.config/jwm/default.jwm</Include> </jwm>
The first line identifies the document as an XML file. The jwm tag pair identifies this as a jwm configuration. Note the included files are subject to the same rules as the default file (xml identifier, jwm tag). The include tag points to where we moved a copy of the original configuration file.
Note you should use relative or absolute paths. Do no use shortcuts, as they will not be reorganized by jwm. For example the shell shortcut “~” for the home directory does not work in the jwm configuration file.
If you restart JWM you should not see any difference with this new configuration setup. In the next post we will start covering the various tags in some detail, and moving them to the smaller configuration files. At some point we will be able to remove the default.jwm file entirely.
At this point we have everything we need to start configuring jwm. In the next post we will work on some of the system settings. This includes such items as startup, menus, default settings and paths.
Specifically we will be looking at the Root Menu. As part of this exercise, we will be downloading and manually adding some icons to our Arch installation.
JWM Agnostic X on Arch – Part 3 – Initial Setup for Config File