JWM Part 7 Bindings and Groups

Published on October 13, 2021 at 6:52 am by LEW

Introduction

In this post we will look at Key Bindings and Groups in JWM. These two features are more operational than they are style related. They are both very useful for setting up your own personal workflow.

Key Bindings are used to set key strokes that trigger specific functions, more commonly referred to as Key Board Shortcuts or Hot Keys.

Group Settings control how a program opens. JWM has a default behavior for opening programs, but this can be changed with group settings.

Key Bindings

In the configuration file file a keybinding takes the following form, with the mask being optional.

<Key mask=”” key=””>action</Key>

If no mask is present then a simple key press will call the action. If a mask is added, then a combination key press will be required. Some of the more common mask options are A (Alt), C (Control), and S (Shift). The JWM home page lists all the available actions for key bindings.

Note that mouse bindings are also possible. I have not personally had a need to use these, so I am unable to comment on setting them up or their usefulness.

Lets run through an example of a key binding. In a previous post we set the menu to be triggered by a zero event which we assigned to the JWM button in the menu. Lets add a hot key to bring up the menu as well. For this example I will use “ALT” + “F1” to open the root menu.

<Key mask=”A” key=”F1”>
     root:0
</key>

In this example the mask requires the “ALT” key to be pressed at the same time as the “F1” key. The action “root:0” is the same action we used for the JWM button in the menu bar. Once we save the file and reload JWM, we can press the “ALT” + “F1” keys to bring up the menu at the pointer.

Groups

The Group Settings are used to change the default behavior of how a program opens. For our example we will change the position, the desktop, and the size of the terminal window when we open the xterm program.

The firs thing we need to do is determine the WM_CLASS name of the window. To do this open a xterm instance and type xprop. A cross hair should show up on the screen. Move this over the xterm instance and left click. Information about the xterm window should be displayed. Scan through the information until you find the WM_CLASS name. It should be “xterm”,”XTerm”. Either entry will work for us.

What I want to do is open xterm on the second virtual desktop, at the center of the screen, with a width and height of 800 pixels. This is how it should look in the JWM configuration file.

<Group>
     <Name>xterm</name>
     <option>centered</option>
     <option>height:800</option>
     <option>width:800</option>
     <option>desktop:2</option>
</Group>

Conclusion

We took a quick look at key bindings and groups in this post. Both of which are simple to use, and, can personalize your workflow.

While neither is essential to using JWM, both can be very useful and have many possibilities. All one has to do is explore.

JWM Part 1 Taking Control
JWM Part 2 The Menu
JWM Part 3 Window Color
JWM Part 4 Desktop Background
JWM Part 5 The Tray
JWM Part 6 Exiting JWM
JWM Part 7 Bindings and Groups

Wiktor Zakrzewski says:

Hi, your tutorial is generally awesome, also quite hard to find unless you specifically search jwm and debian. I got ubuntu and I installed jwm using apt. I really really struggle with changing the default blue color of window borders. Actually there is blue color set not only in window borders but in pager and menu as well. I totally deleted any blue color from both .jwmrc and system.jwmrc files and made sure that respective colors were changed to ANYTHING else, but it doesnt work for some weird reason. whatever I type in window style or it is always blue as it was from the start.
I am really getting tired. what am I missing? is there some kind of configuration file that overrides those color settings? If so, I have no idea where to look for this config file. it has to be debian specific, and nowhere to be found. Nobody shares this information anywhere, this is stupid.
Please any help would be pure gold.
Thanks Mate for reading.

Wiktor Zakrzewski says:

OMG this is embarassing…but not really…

I solved the problem. I installed jwm on different debian based distro(q4os)
to check if I can have the same problem there. And I think it had a little different jwmrc file (although I could hallucinate that) where it was not using or tags, but foreground and background tags….
gosh. Its not that not using gui is scary.
it is just that all those manuals and instructions provided are not clear enough.
anyway. sorry to bother.
have a great day.

LEW says:

Wiktor,

Thank you for leaving a comment. Sorry that you had difficulty finding this site. It has only been around for a couple of months, so does not yet rank well in the various search engines.

It seems from your comments that you have found a work around for your problem? If so, that is good. If not I would offer the following suggestions.

If JWM is installed from the authors source code, then the configuration file is found at “/usr/local/etc/system.jwmrc”. In the Debian package it has been moved to “/etc/jwm/system.jwmrc”. I have not looked at an Ubuntu distribution for a few years, I will install one on a virtual machine this weekend and see what is what with their JWM package.

Another possibility that I had an issue with when I first started using JWM, if you have a “.jwmrc” in your home directory, it will override the system.jwmrc, no matter where it is located. Dot files are normally hidden and directory content must be listed with “ls -a” to see them.

If you are still having issues, can you send me a copy of your configuration file to examine?

Lee Wulff

Add New Comment

Your email address will not be published. Required fields are marked *