Using some Pekwm settings in Openbox

January 5, 2008

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.😉

6 Responses to “Using some Pekwm settings in Openbox”

  1. 3ark said

    Very useful. I’m loving the fill commands when I’m using gimp. I had no idea openbox could do this. Thanks!

  2. ah said

    i love the growtoedge thing! i’ve been looking for a a feature alike, thanks!
    it indeed behaves kind of weird tho, i’ll get used to it! : D

  3. Anthony Thyssen said

    Running xkill with with the arguments
    xkill -button 3
    will make the thrird button not only initiate the action
    but also kill the window. That way you can kill the window quick with a double 3rd button, or abort with any other button!

    Of course it is dangerious so maybe better to leave it with the first button so a 3 then 1 button combo is the window kill🙂

  4. […] Az rc.xml fájlban az egérrel kapcsolatos kombinációk jönnek. Ide kerülnek azok a dolgok, amik klikkelés, elhúzás vagy egér gomb lenyomás hatására történnek. További infomációért lásd az Openbox documentációt. További példák itt. […]

  5. Shawn said

    Hello,

    Whats wrong with my syntax here?

    echo “foo” > ~/bar.log

  6. Shawn said

    Your comment section doesn’t like xml.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s