A simple Pekwm guide

January 10, 2008

I have posted a simple guide to install and configure Pekwm on the Ubuntuforums.

Don’t expect anything extraordinary. I only tried to help those new to Pekwm to install the latest stable version and give them some hints of what Pekwm can do. If you know the official documentation of Pekwm, this little guide will not contain anything new for you.

I’m in the mood to post a picture, so here is the Pekwm howto in Epiphany, with the black ubuntuforums userstyle:

Free Image Hosting at www.ImageShack.us

Hopefully this will create some more interest in Pekwm among Ubuntu users, so that when I run into problems, there is someone to help me 😉 .

If you have any feedback on the guide, I am, as usual, very happy to hear from you.

Earlier I wrote about my attempts to make Pekwm behave more like the default behaviour of Openbox. I have been using Openbox for quite a while now, and I am used to have my window manager do certain things in very specific ways. Whenever I experiment with another window manager, I always try to make it do what I am used to, and my fondness for the new kid generally reflects on how successful I was at that.

This may be seen as an unfair standard of judgement (since the application might have been created precisely to do things very differently), but what I am really exploring is how customisable the application actually is. Customisability is a major feature for me, and most of the applications I like are either very strong in it (like Opera and Openbox) or are so simple that they don’t need any customisation (like Mousepad/Leafpad or docker). If I can make a window manager work like my Openbox setup even though its defaults are very different, it is a good and flexible window manager.

Sometimes, though, I see good things in other window managers and then try to replicate those in Openbox. Here are a few things I immediately liked in Pekwm and tried to apply in Openbox.

Easy resizing of windows

To resize a window in Pekwm is very convenient. You don’t have to move to the window border and (especially if these are rather small) try several times to click on the right spot. Rather, if you hold the Alt key (Mod1), right click on the window client (the main window) and drag your mouse, the window will resize in that direction. If you’ve used this feature even for just a short time, you understand how handy this is!

This configuration is default in Pekwm, and as soon as I was back in Openbox I wanted Openbox to behave likewise. This is, of course, very simple. Just add the following to the your rc.xml file, in the mouse section, under <context name=”Client”>

	<mousebind button="A-Left" action="Drag">
	   <action name="Resize"/>
	   <action name="Focus"/>
	   <action name="Raise"/>
	</mousebind>

Reconfigure Openbox, and you can resize all those Gimp, Mousepad, Terminal and Thunar windows so much smoother!

Make a window fill the screen

Apart from the ‘Maximize’ command, Pekwm has by default also a ‘Fill’ feature. If you apply this to a window it grows until it reaches either a window border or the screen edge. You can make a window fill horizontally, vertically, or both (in all directions). It is a neat feature that I find more useful than tiling (as I rarely want to see all open windows at once). I only have a need for this occasionally, but it is handy to have it around for when it is needed.

It turns out that Openbox allows you to do this as well. It is not enabled by default, but it can be easily achieved with the ‘GrowToEdge*’ actions. In true Openbox spirit, you get more options than Pekwm has. You can not just fill the window horizontally, but upwards (North), downwards (South), to the right (East) and left (West). I have set this up so that when I press the windows key and one of the arrow keys, the window will grow in that direction. Here is what I added to my rc.xml in the keyboard section:

	<keybind key="W-Left">
	   <action name="GrowToEdgeWest"/>
	</keybind>
	<keybind key="W-Right">
	   <action name="GrowToEdgeEast"/>
	</keybind>
	<keybind key="W-Down">
	   <action name="GrowToEdgeSouth"/>
	</keybind>
	<keybind key="W-Up">
	   <action name="GrowToEdgeNorth"/>
	</keybind>

This doesn’t work as smoothly as Pekwm’s ‘Fill’ command, though, as Openbox recognises

all

window borders, even those of windows that are in a layer far below the layer it is in. Still, it is a useful feature. If you’d like to have the window grow vertically or horizontally (in both directions) or in all directions, you can combine two or more of the above actions for a single keybind or mousebind.

(While searching for this, I also discovered Openbox has ToggleMaximizeHorz and ToggleMaximizeVert actions, which are in the default configuration bound to a right click and a middle click on the maximize button respectively. I doubt I’ll use this very often, but it is nice to know)

Kill a window with a right click

Besides a ‘Close’ command, Pekwm also has a ‘Kill’ command that can be used to kill windows that you are unable to close with ‘Close’. The command is not used in the default configuration of Pekwm except in a keychain, but some themes bind it to a right click on the close button by adding the following line to the close button settings:

	Button = "3" { Actions = "Kill" }

Openbox does not have a Kill action, but you can achieve nearly the same if you use xkill. Add the following to your rc.xml in the mouse section under <context name=”Close”>

	<mousebind button="Right" action="Click">
	  <action name="Execute">
	     <execute>xkill</execute>
	  </action>
	</mousebind>

With this setting, right clicking on the close button launches xkill. Click again with the left button and the application is killed. It requires an extra click and is not quite as elegant as Pekwm, but it does the job.

***

Conclusion: Openbox passed my test, once again. It is great to discover how many features it has, and though it is obvious that you can configure Openbox any way you want, doing so is always exciting and good clean fun. My Openbox setup has just become even more closely attuned to my needs and wants.

I find It also practical to have the applications I use frequently behave in the similar ways. Otherwise I keep wondering why my system is unresponsive or why application xyz no longer functions properly, or I start disliking it for totally unvalid reasons. 🙂 This is especially true for window managers. A window manager should have plenty of options to use and be (potentially) aesthetically pleasing, but it should remain in the background. In my world, a good window manager is one that you don’t notice, either positively or negatively, since all it has to do is manage windows, not entertain. 😉

One of the nice features of Pekwm is that it allows you to use dynamic menus, menus and entries that display the output of a script that is run each time the menu is accessed. Here is how you can display the time and date in your root menu (or window menu, if you’d like that). I’ve adapted what follows from here.

Create a new file in a place that is convenient for you. (I keep such dynamic menus in a subdirectory called “menu” in the ~/.pekwm directory.) Add the following to that file:

#!/bin/bash
echo "Dynamic {"
echo " Entry = \"`date +'%a, %e %B - %H:%M'`\" { Actions = \"Exec osmo & \" } "
echo " }"

Make the script executable (chmod +x /path/to/script), and add the following to your menu file (in ~/.pekwm):

Entry = "" { Actions = "Dynamic  /path/to/the/script"}

If you reload Pekwm, you will have a menu item that displays the time and date. If you click on the time and date, Osmo, a nice light calendar, todo list and contact management application, will launch. Replace it in the above command with any other application you like (Orage, dzen with a calendar script, etc.). If you prefer not to have any application linked to the entry, use the following line in the above script (instead of line 3):

echo " Entry = \" `date +'%d.%m.%y - %H:%M'`\" { Actions = \"Exec source /dev/null & \" } "

If you want the date and time to display in its owm submenu, add the following to your menu file:

Submenu = "Date and Time" {
	Entry = "" { Actions = "Dynamic  /path/to/the/script"}
}

You can also easily change the date and time format to your liking. Below are two screenshots; the first shows the date and time on the main menu with the command `date +’%d.%m.%y – %H:%M’`, the second shows it in a submenu with the command `date +’%a, %e %B – %H:%M’`.

Pekwm time and date

Some Pekwm configurations

December 30, 2007

I’ve recently started using Pekwm again. Pekwm is a light window manager, in looks similar to Openbox or Fluxbox that allows you to tab windows, has good keychains options, can use dynamic menus (‘pipe-menus’ in Openbox) and supports pixmap themes. I played with it a little nearly a year ago, but never long enough to explore all its possibilities. I’ve now grown very fond of it, and have worked out solutions to all the little things that bothered me at first. The documentation is excellent and covers all what you need to configure Pekwm (the documentation is for Pekwm 0.1.5, though, and doesn’t cover some of the new features introduced in the latest stable version, 0.1.6). Below are some of my own settings to make Pekwm behave the way I want it to. This is meant mainly to remind me what I did if I need to reinstall Pekwm later on, but perhaps some of you will find some use for it as well.

Focus on click

By default Pekwm focuses a window when you move your mouse over it. To change it to a ‘focus on click’ behaviour is made very simple by the developers. In your mouse file look for the following lines and do what it says:

#Remove the following line if you want to use click to focus.
And: #Uncomment the following line if windows should raise when clicked.

Changing the way the menu behaves

The default configuration in Pekwm (and Fluxbox, actually) for the display of menus, specifically the hiding or closing of menus, irritates me. To close an open menu, you either have to launch one of the items on the menu or right click on the menu heading. I am, however, used to Openbox’ approach: when you click anywhere outside the menu or when a new menu is launched, the open menu simply disappears. Here is how to achieve this in Pekwm.

All of this is obviously done in the mouse file. First of all, I added “HideAllMenus” before all “ShowMenu” commands. In this way, if I open the root menu any window menu that might have been open automatically disappears. Here is an example from the FrameTitle section:

ButtonRelease = "3" { Actions = "HideAllMenus; ShowMenu Window" }

Then add the same command to the right clicks on the window decorations and window clients. In the FrameTitle and OtherTitle sections, create the following line:

ButtonRelease = "1" { Actions = "HideAllMenus; Raise; Focus; ActivateClient" }

In the Client section, add the following:

ButtonPress = "1" { Actions = "HideAllMenus; Focus; Raise" }

Edit the following lines in the keys file, to make menus disappear when you switch desktops:

KeyPress = "Ctrl Mod1 Left" { Actions = "HideAllMenus; GotoWorkspace Left" }
KeyPress = "Ctrl Mod1 Right" { Actions = "HideAllMenus; GotoWorkspace Right" }

Autohiding the harbour

The harbour is Pekwm’s version of Openbox’ dock or Fluxbox’ slit. It is the place where dockapps are loaded. Unlike the dock and the slit, the harbour cannot be set to autohide. Since I don’t like panels, I use the harbour for a system tray (docker) and a clock (bbtime or lal), but I don’t want to have it always on top or always below all other windows; nor do I want a strut for it. Here is what I did to create a ‘semi-autohiding’ harbour. My harbour shows up in the lower right corner of my screen.

In the Down part of the ScreenEdge section of the mouse file, I added the following line:

Enter = "Any Any" { Actions = "Toggle HarbourHidden" }

This toggles the harbour whenever I move my mouse to the bottom of the screen. The downside is that there is no ‘autohide’ feature; to make the dock disappear again you have to move your mouse back to the bottom of the screen.

To set the harbour to disappear again, I’ve configured Pekwm to hide the harbour again when I click on a window or window title. I added the option “Set HarbourHidden” to the following lines.

In the Client section:

ButtonPress = "1" { Actions = "HideAllMenus; Set HarbourHidden; Focus; Raise" }

In the FrameTitle section:

ButtonRelease = "1" { Actions = "HideAllMenus; Set HarbourHidden; Raise; Focus; ActivateClient" }

In the OtherTItle section:

ButtonRelease = "1" { Actions = "HideAllMenus; Set HarbourHidden; Raise; Focus" }

This isn’t quite autohiding, but it is good enough for me.

Normal alt-tab behaviour

As I don’t use a panel, the way the alt-tab window switching works is a big deal for me. I’ve never grown very fond of Fluxbox, for example, because it doesn’t have an alt-tab display. The default alt-tab behaviour in Pekwm does not focus the next window and place it at the top of the list. The default alt-tab therefore switches between windows in the order that they were launched. Impractical in my book, but this is easy to change. In the keys file, change “NextFrame” and “PreviousFrame” into “NextFrameMRU” and “PreviousFrameMRU” (there is already a default entry with these commands). Reload Pekwm and you will have a ‘normal’ alt-tab.

***

Pekwm is a great window manager. The only downside is its scarcity of good themes. You can find a few on Box-look, Hewphoria, and FreshMeat, but most of these are visibly several years old (some aesthetics change rapidly). So if you use Pekwm and have some artistic ability, please create some new themes!

Here is a screenshot of my current Pekwm setup. Yes, that is a purple desktop 🙂

Pekwm