Using Pekwm’s screen edges

January 29, 2008

One of the great features of Pekwm is the ability to use the screen edges. Just like the desktop, you can click on the screen edges to perform certain actions. In the default settings, right clicking on the screen edges brings up your root menu, middle click on it and you see your client menu, left click on it and you will switch to the next workspace in that direction.

The beauty of the screen edges is that, unlike the desktop, they remain available when you have maximize windows or windows in full-screen mode. This means you can still use the mouse to call up the root menu (without setting a margin, as you would in Openbox), or perform other actions. I really hope this is implemented in one of the future releases of Openbox (and hope any of the Openbox devs is reading this! :-)).

Earlier I have written about how you can use the screen edges to semi-autohide the harbour, but their potential is much greater. I will describe two examples here, and hint at a few more uses .

Tilda

Tilda is drop down terminal. Though I rarely use it myself, it is a handy app if use the terminal regularly, but don’t want to switch to the open terminal whenever you need it: Just press a key (F1 by default) and your terminal window drops down from the top of the screen.

Tilda only appears with a keypress, though, so you’ll have to translate or simulate the keypress with a command. After much searching and asking, I finally found several ways of doing this. The easiest is by using xautomation. First install the application:

	sudo aptitude install xautomation

Xautomation allows you to control X from the command line, and consists of several applications. The one you will need here is xte, which generates fake mouse or key inputs. To have F1 pressed and released, you would use the following straightforward command:

	xte "key F1"

(A more complex way of doing this is by using xmacro as explained here)

Now you will have to bind this to a mouse action on a screen edge. Since Tilda is a drop down terminal, I prefer the upper edge (‘Up’) and add the following line to my mouse file (in ~/.pekwm) in the ScreenEdge Up section:

	ButtonRelease = "1" { Actions = "Exec xte 'key F1'" }

Reload Pekwm and whenever you left click on the top screen edge, Tilda will appear (provided Tilda is running obviously). If you would like Tilda to appear whenever the mouse moves over the top screen, use the following line:

	Enter = "Any Any" { Actions = "Exec xte 'key F2'" }

Skippy

The real reason I started playing with Pekwm’s screen edges was to play with one of my much-loved applications: skippy, a full screen task switcher

I wanted to see if I could create a Mac exposé-type effect: if I move my mouse in a particular corner of the desktop, skippy automatically launches and I get a miniature version of all open applications on my screen.

Using Pekwm’s screen edges and xte, this is fairly easy to achieve, were it not that skippy doesn’t actually work like it is supposed to in Pekwm. Skippy launches fine, but remains under the open applications. I’ve tried several things, and the only workaround I have now is to raise the skippy window with wmctrl, but even that is problematic.

If you haven’t done so already, install wmctrl first (sudo aptitude install wmctrl). You now need to get the id for the skippy window. To do this, launch skippy as usual and keep the window miniature windows open. In a terminal type “wmctrl -l” and you will get an overview of all running windows, like this:

	0x02a00001 -1    N/A N/A 
	0x01e00004  0 yantra Blank page 
	0x01a00003  0 yantra urukrama - File Manager 
	0x0240001e  0 yantra Terminal 
	0x01800002  0 yantra [pekwm-users] Skippy and Pekwm 0.1.6 - Opera 
	0x01600003  1 yantra System Monitor 
	0x00c00003 -1 yantra panel 
	0x01000001 -1    N/A netwmpager

The first column contains the window identity as a hexadecimal integer, the second the desktop number (-1 is a sticky window), the third contains the name of your computer, and the final column shows the window title. In the above list, Skippy is the first entry (where the title is given as N/A). You will need the window id of this (in this case 0x02a00001) to raise skippy automatically to the top whenever it is launched. Then open your ~/.pekwm/mouse file and add the following lines to the ScreenEdge section (choose whichever screen edge you prefer; I add it to the right one):

	ButtonPress = "2" { Actions = "Exec xte 'key Scroll_Lock'" } 
	ButtonRelease = "2" { Actions = "Exec sleep 1 && wmctrl -i -r 0x02a00001 -b add,above" }

I have configured skippy to launch when I press Scroll_Lock, so these settings will launch skippy whenever I middle click on the (right) screen edge. Replace Scroll_Lock with whatever key you have bound to skippy. The second line is used to make wmctrl raise the skippy window to the top a second after it is launched.

There are several important disadvantages of this workaround. First of all, skippy’s id changes with every session, which means you’ll have to edit the above entry at the beginning of every session. The second downside is that skippy won’t be raised if it first needs to take a snapshot of all open windows, as that takes more than a second. In such a situation, you’ll need to launch skippy twice.

Despite its limitations, I think this is rather neat🙂 I am not sure who is to blame here – Pekwm or skippy – but I hope it is Pekwm because that would increase the chances that this problem gets fixed (skippy is no longer developed). If you know of a simpler way to go around this problem (or how to solve it!) please let me know.

Other uses

The potential of the screen edges is great, as you’ve probably guessed by now. Though the mouse has only a few buttons, you can combine those with modifier keys (Ctrl, Alt, Mod4), which gives you a few more options to use on the four screen edges you can play with.

Here are a few more ideas: use the screen edges to launch osdsh to display the time (osdctl -t 4), or the state of your laptop battery (osdctl -b “Battery Power”,$(acpi|cut -d “,” -f2|cut -d “%” -f1|cut -d ” ” -f2)), launch an application launcher like apwal, hide panels or taskbars like visibilty or tint that don’t support hiding (this will be a bit slower, no doubt, but it works), tile windows with tile, etc.

9 Responses to “Using Pekwm’s screen edges”

  1. Mikachu said

    Hi, I have a branch in git for edges in openbox, right now they just do the same as the root context though, but maybe you want to play with it?

  2. urukrama said

    Thank you. This looks promising🙂 Keep up the excellent work!

  3. […] 23, 2008 I’ve figured it out! You may remember I was trying to get a Exposé-type behaviour with Skippy in Openbox: move the mouse in a screen corner and […]

  4. Navi said

    For the skippy-pekwm trick, have you tried writing a script that makes all the other windows go under skippy instead of trying to make skippy lord over them? You can have it so that the stacking restores after you finish using skippy.

  5. Navi said

    Hey, the following works using skippy (no composite) and pekwm 0.15 (default for debian lenny):
    Edit .skippyrc so that useNETWMFullscreen = false
    That makes skippy go.🙂

    ~Navi

  6. sticky said

    I know this is an old post, but I think it’s worth mentioning, it is possible to have screen edges in openbox. Just configure openbox to have a 1 pixel margin on the left and right sides of the screen. It is completely unnoticeable and allows you to access the root menu even when a window is maximized.

  7. […] this behaviour with this window manager. One of Pekwm’s neatest features is its use of screen edges: you can assign mouse actions to the edges of the […]

  8. Susannah said

    Hi there just wanted to give you a quick heads up. The text in
    your post seem to be running off the screen in Chrome.

    I’m not sure if this is a formatting issue or something to do with browser compatibility but I thought I’d post to let you know.
    The design and style look great though! Hope you get the issue resolved soon.
    Many thanks

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