JWM Agnostic X on Arch – Part 5

Published on November 10, 2022 at 6:33 pm by LEW

Introduction

In this post we will look at the menu system in JWM. There are third party ways to automate population of the menu system, but I prefer to define my menus manually, to be just what I need/want them to be.

One of my problems with the automated approach to menus is that I sometimes have trouble finding items on the first couple of uses, sometimes jumping to the command line in frustration. I never have this issue with menus I generate manually. And I never get any extra stuff I don’t want.

I am going to start by reviewing the various parts of the JWM menu. Then I do need to make one brief detour before getting into details of menu setup, I need to get some basic icons installed.

JWM Menu Parts Identification

Before we start walking thorough the configuration of the menus, we need to review the various parts of the menu that you can configure. This will help clarify some of the terms we will use in our discussion about setup and configuration. Below is a picture of a rather simple JWM Menu layout that we will use for this discussion.JWM Menu Parts

Setting Up Some Icons

I mentioned the Tango icon set in earlier posts of this series. I am going to do a manual install. If you use an automated install, (thought a package manager, AUR, or script) you tend to get the icons and a lot of links for various environments (like KDE and Gnome) that we are not using. This is where you can get the Source Tango icon pack.

I downloaded the latest version of the icon pack and used xarchiver (installed in the last post) to extract the folders.

I then copied the 16×16, 22×22, 32×32, and scalable folders over to /usr/share/icons/tango. Note you will need sudo permissions to do this. If you want you can go in and delete the makefiles in each folder, as we will not be using them.

Next we want to cut the icon path information from ~/.config/jwm/default.jwm and paste it into ~/.config/jwm/system.jwm (we discussed these folders and directories in a previous posts). If you have not been following along, then you need to basically modify the icon paths in your jwm configuration file.

As usual I start new sections with a comment. Then I modify the icon paths to what I will need, deleting any I do not need. There are only five of them initially. May need more at a later point. When finished, the section should look similar to the below example (with variations for your own setup).

 <!-- Icon Paths to Search -->

<IconPath>/usr/share/icons/tango/scalable/actions</IconPath>
<IconPath>/usr/share/icons/tango/scalable/apps</IconPath>
<IconPath>/usr/share/icons/tango/scalable/places</IconPath>
<IconPath>/usr/share/icons/hicolor/scalable/apps</IconPath>
<IconPath>/usr/share/jwm</IconPath>

Note I am using Scalable Vector Graphics (SVG) icons. Depending on your distro and what is installed, this may or may not work. If it does not work, then change “scalable” to one of the bitmap directories, like “32×32” for example.

Defining a Menu

Lets get to making a menu system that points to actual application we have installed. I am assuming you have been following along, and will be working with application installed in earlier posts. However the principles are the same regardless of what you have installed.

First, to run a quick test, launch your application from the command line. This proves it works correctly, and you have the correct command to launch it.

I will start by moving the root menu section from ~/.config/jwm/default.jwm to ~/.config/jwm/funciton.jwm. Don’t forget to add the boiler plate (earlier posts in this series), and to make a comment at the start of the section. I will be modifying parts of the copied material and deleting the rest.

You also need to add a line to ~/.jwmrc pointing to the function.jwm file.

<Include>/home/user/.config/jwm/function.jwm</Include>

RootMenu: A menu resides within the <RootMenu></RootMenu> tags. You can have multiple RootMenu tags, but you need to make sure they have different onroot modifiers set. For our initial menu we will make a modification to what we copied over, to add the label, then the separator.

<Rootmenu onroot=”12” labeled=”true” label=”Archer”>
	<Separator />
	…
</RootMenu>

The onroot parameter is set to the left (1) and middle (2) mouse buttons (we will talk about setting up the mouse and root menu parameters latter, but for now use the default). Labeled is set to true, meaning we will define and use a label. And the label Is set to the text string “Archer”.

The <Separator /> token will draw a line below the label. It is actually the top entry in the menu. Note that this style of tag (with the appended “/”) does not require a closing tag.

Menu: Next we will create our three menu (folder) items between the Rootmenu tags. They are all identical, just the labels are different.

<Menu icon=”folder” labeled=”true” label=”Network”>
	<Separator />
	…
<Menu>

Similar to the Rootmenu tags, we add a separator between the label and the sub menu. we also added an icon. This will search the defined icon directories for a name match. Note that the extension is not matched, so icon.svg is the same as icon.png. What is displayed will depend on what libraries are installed by your distribution or yourself. For example; libRSVG for SVG icons, libpng for png icons, or libjpg for jpeg icons.

Program: Next, the Program tag, that actually runs an application for us. For this example, we will add Firefox under our Network menu. A set of program tags looks like the below example.

<Program icon=”firefox” label=”Web browser” tooltip=”Firefox”>
    firefox
</Program>

The options are similar to the menu tags. What resides in between the Program tags is what is executed by the menu. This should be the command used in the terminal to launch a program. Note you can also add options to the command. For example if we add “-private” to the command, it opens firefox in private browsing mode.

Restart and Exit

Both Restart and Exit, which are in the default menu structure, are built in RootMenu commands, and not external programs. There are about twelve built in commands. We will be covering a few more of them later.

Most built in commands have similar options, label, icon, and tooltip. Some have additional options. For example the Exit command has the “confirm” option.

The Restart command basically restarts JWM, rereading the configuration files.

The Exit command basically exits the JWM environment.

My Menu Structure

For my menu system I have added menus for Network, System, and Utilities. Firefox is under Network, xterm is under System, and xarchiver, pcmanfm, and geany are under Utilities.

The firefox, geany, and xarchive icons were installed to hicolor/apps. For xterm and pcmanfm, I am using the default icons from the Tango/apps; utilites-terminal and system-file-manager.

The Folder icon comes from Tango/places, and the Restart/Exit icons come from Tango/actions.

Conclusion

In this post we have setup/modified the basic JWM menu structure. This was just the first pass at the menu. We will be coming back to some menu related subjects in  several latter posts. But between now and then, install some applications, and add some menus and programs to your own JWM menu.

In the next post we will talk about the JWM taskbar

JWM Agnostic X on Arch – Part 1 – The Install

JWM Agnostic X on Arch – Part 2 – Adding Some Applications

JWM Agnostic X on Arch – Part 3 – Initial Setup for Config File

JWM Agnostic X on Arch – Part 4 – StartupCommand and Group

JWM Agnostic X on Arch – Part 5 – Building a Menu Structure

JWM Agnostic X on Arch – Part 6 – Tray Attributes

JWM Agnostic X on Arch – Part 7 – Tray Content

JWM Agnostic X on Arch – Part 8 – Desktops, Bindings, Colors, and Fonts

JWM Agnostic X on Arch – Part 9 – Styling of Major Elements

JWM Agnostic X on Arch – Part 10 – Some more Styling

JWM Agnostic X on Arch – Part 11 – Additional functionality

Add New Comment

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