Some Pypanel tips

May 31, 2008

Judging from the screenshots that are posted on the Ubuntuforums and the Arch Linux forums, Pypanel is probably the most popular panels among Openbox users. Pypanel is no longer developed, and the latest version of Pypanel (2.4) is from 2005 (though a few patches have appeared recently; see here, here, and here). It doesn’t offer nearly as many features as some of the other panels, and doesn’t have any graphical tools to change its preferences. But its simple aesthetics and lightness have captured the attention of many (including me).

Configuring Pypanel is relatively easy: it all takes place in a single file, ~/.pypanelrc. Most of the settings in that configuration file should be fairly straightforward, and the default is well explained. You can specify the colours, fonts, looks, the size and position of the panel, set application launchers, modify the clock, etc. Restart Pypanel and the changes will be visible.

What many users don’t know, however, is that the clock and desktop sections of the panel can also be configured (beyond how they look). You can specify a number of actions that are performed when you perform a mouse action on it (left/right/middle click, scroll up and down). The default actions involve changing workspaces or iconifying all open windowns and showing the desktop. The type of actions Pypanel can perform, as well as the codes for the various mouse actions are specified towards the end of the pypanelrc file, under “Button Event Function Definitions”. But there is more to it than specified there.

The actions are of the following syntax: two letters, signifying the type of action that follows, followed by a dot, and the action name. pp stands for a Pypanel action; os (presumably) for an operating system action (e.g. pp.showDesktop()). The internal Pypanel actions are those specified in the default configuration file. They are actions like focusing a window, raising a window, minimizing it, changing the workspace, hiding the panel, and so on. Note that the showDesktop() action only works if your window manager supports minimizing all applications at once; the action will, for example, not work in Pekwm. The os actions can be used to launch applications. If you don’t want to specify an action you can use the command pass.

Here are a few examples. Below is the clock section of my current pypanelrc. Left-clicking on the clock launches a dzen2 script (modified from this) that displays a calendar; right-clicking on it launches Osmo, a personal organizer.

def clockButtonEvent(pp, button):
""" Button event handler for the panel's clock object """

if button == 1:
os.system("/home/urukrama/.scripts/dzen_calendar &")
elif button == 2:
elif button == 3:
os.system("osmo &")
elif button == 4:
elif button == 5:

Here is a screenshot of the dzen2 calendar (the pager on the right to Pypanel is netwmpager):

Similarly, the desktop area of the panel can also be used to trigger certain actions. You can, for example, use that area to launch an applications menu. If you’d like to use the menu of your window manager, you can use xte or xdotool to launch it. Alternatively, you could use something like Tabble (without the window decorations), or Apwal for a drawer-like effect.


May 26, 2008

Over the last few weeks, I have slowly been updating the Openbox guide. Openbox 3.4.7 has been out for a little while now, and Ubuntu Hardy was also recently released. I needed to update a few sections of the guide (mainly those covering the installation of Openbox, Obconf and Obmenu, and the shutdown/reboot section). The Openbox FAQ has been changed a little as well.

But this new version of the guide is more than just an update. I have thoroughly revised the entire guide, rewritten some parts of it, and added a lot of new material. So what has changed?

First of all, it has a table of contents now 🙂 , which should make navigation easier and give the reader a better grasp of what areas the guide covers.

I have added a lot of new material to it: I have enlarged the sections on panels, docks, system trays, pagers and clocks. The list of ‘useful applications’ at the end of the guide is now much longer (it now contains eleven applications, whereas the old one contained three). I have tried to give KDE/Qt applications more attention, and included a section on how to deal with Qt themes in Openbox. The guide contains more information about font configuration and mouse cursor themes.

I have tried to clarify and explain the commands and applications more, hopefully making it more accessible and educational for persons relatively new to Linux and/or window managers. I have also added a lot more links to external sources of information, project websites and howtos/guides.

Here are some statistics:

The old guide contained 7275 words; the new version of the guide has 9343 words (2068 words more). The old version had 90 links to external sites, the new version has 159 links (69 links more).

The old guide was completed on 26 November 2007, and revised on 22 January 2008 (some minor changes were made in between and since then). Since it was posted, the Openbox guide has received 14,218 views (13,302 and 916 before it was moved to its own page). That is an rough average of 78 persons a day. Not the most frequented website in the world, but a lot more than I thought I would get when I wrote that guide. The entire blog has had 25,968 people over, so more than half of the views were for the guide. ‘(An) Openbox guide’ is the second most common search term that lead people to my blog (297; the first place is occupied by ‘dmenu‘ with 304 hits — it seems there isn’t that much information about dmenu available on the internet…).

Here is a picture of the stats for this blog:

And here is one for the Openbox guide alone:

Writing and maintaining the Openbox guide sometimes forces me to venture into areas I would normally not go: I don’t like docks, for example, but have tried some of them out so I could write about them. I no longer use xcompmgr and transset, but need to know how to use it as my of the readers of the guide are interested in it. I need to download, compile and install a lot of applications. One of my computers is (not exclusively) used for that. It started with a slim command-line Ubuntu Hardy install, and has now well over a thousand packages installed! I do discover a lot of interesting applications this way, though — especially old(er) ones, many of which are no longer developed, but are still handy, interesting and/or fun.

So that’s it. Go and have a look at the new guide 😉 I hope you find it useful. If you have any suggestions for improvements, or find some grave, less-grave or not-very-grave errors in the guide, please let me know. I love feedback.

The artwiz fonts, a set of bitmapped ‘futuristic’ fonts, are no longer in Ubuntu’s (Hardy’s) repositories. But don’t despair! Though installing these fonts is no longer as easy as apt-getting it, installing them manually isn’t that hard.

Download the fonts from this Sourceforge page. These are the ‘improved artwiz fonts’ that should work in Gtk2 and KDE3 applications. Once you reach the download page, you’ll see there are three versions available: German (de), English (en) and Swedish (se). These are basically the same fonts, but with different language encoding support (think ü, ö, etc.). You’ll only need one of them; pick the one you like.

If you want full ISO-8859-1 support, you can also use the artwiz latin1 fonts.

Extract the archive and move the extracted folder to /usr/share/fonts/X11/misc (the examples below use the English (en) font set)

tar xvjf artwiz-aleczapka-en-1.3.tar.bz2
sudo mv artwiz-aleczapka-en-1.3 /usr/share/fonts/X11/misc

Renew your font cache:

sudo fc-cache -f -v

Reconfigure your fontconfig settings:

sudo dpkg-reconfigure fontconfig

Enable the use of bitmapped fonts:

sudo dpkg-reconfigure fontconfig-config

Answer the questions as follows. First select the font tuning method (I chose Native):

Set the subpixel rendering of the fonts to ‘Automatic’:

And finally, enable bitmapped fonts:

Once you have restarted X, you should be able to use the artwiz fonts in your Gtk, Qt and Openbox settings.

If you want to use the artwiz fonts in conky, you no longer have to disable xft. To display conky with the artwiz font snap, use the following settings:

use_xft yes
font snap-7

Finally, if you want the artwiz fonts to also show up in xfontsel, specify the path to your artwiz fonts in the “Files” section of your /etc/X11/xorg.conf. Here is what that section looks like on this computer:

Section "Files"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "/usr/share/fonts/X11/util"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/misc/artwiz-aleczapka-en-1.3/"

Restart X, and you should be able to select them in xfontsel.

Thanks to Ubuntugeek and the Ubuntu Wiki.

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 Skippy launches to show you all non-iconified windows on that workspace. Well, I’ve found a solution using Xautolock.

As the name suggests, Xautolock is meant to launch a screen locker, such as xlock, automatically when the mouse cursor is inactive in one or more of the screen corners. It can, however, easily be used to launch any type of application.

Here is how you can use it with Skippy. Add the following line to your Openbox autostart file:

xautolock -locker "xte 'key Scroll_Lock'" -corners 0+00 -cornerdelay 1 &

This will launch xte (-locker “xte ‘key Scroll_Lock'”) when the mouse cursor has been in the upper right corner (-corners 0+00) for a full second (-cornerdelay 1). You can specify many more options; have a look at the very detailed man page for more info. Xautolock runs very light (80 kb on this computer), so it shouldn’t slow things down.

Xte comes with xautomation. It simulates a key press, in this example of the Scroll_Lock key, which is the key I use to launch Skippy. If you launch Skippy with a different key (the default is F11), make sure to change the above xte command appropriately. You obviously need to have Skippy running for this to work. Unfortunately Skippy is not in the Hardy repositories (though it was in the repos from Dapper to Gutsy), so you’ll have to build it from source.

And that’s it! Whenever you move the mouse cursor into the upper right corner Skippy will show you all non-iconified windows. Here is a picture:

This should also work in Fluxbox or other window managers. Pekwm still has issues with Skippy, unfortunately, so this won’t work as elegantly in that window manager.

As is probably clear to the reader of this blog, I mainly use two window managers: Pekwm and Openbox. Both look very differently on this computer, though. My Openbox session is dark blue and purple; my Pekwm session, on the other hand, looks orange and black.

Up until very recently, the first thing I often had to do after I logged into either sessions, was to edit the .gtkrc-2.0 file and (re)set the appropriate Gtk theme settings. I have suggested elsewhere to use both the xfce-mcs-manager and the gnome-settings-daemon to avoid clashing themes between sessions, but I prefer not to load these daemons.

Here is my current solution. First, I created two new gtkrc files that contain the Gtk settings I use in Openbox and Pekwm: ~/.gtkrc-2.0.Openbox and ~/.gtkrc-2.0.Pekwm. I then added the following line to my (auto)start file to overwrite the default ~/.gtkrc-2.0 file with the gtkrc file for Pekmw/Openbox:

For Openbox:

cp /home/USERNAME/.gtkrc-2.0.Openbox /home/USERNAME/.gtkrc-2.0 &

For Pekwm:

cp /home/USERNAME/.gtkrc-2.0.Pekwm /home/USERNAME/.gtkrc-2.0 &

And voilà! No more Gtk settings that conflict with the Pekwm/Openbox theme or wallpaper. This solution is probably very obvious to many, but perhaps some of you will find it helpful. This will, of course, also work if you use Openbox and a destkop environment (as separate sessions); just uncomment everything your custom Gnome/Xfce gtkrc file (as above), so that its daemon can set the themes properly.

Do you often end up with a cluttered desktop where you have several instances of the same application running? You need quick access to a particular application (often a file manager or terminal in my case) and instead of looking for the current open instance you launch a new one. After a few hours, you notice you have 4 terminals running and three Thunar windows, where one instance of each would suffice. If you often end up in a similar situation, despair no more!

Vaughn Dickson posted a very handy script on the Openbox mailing list and his wiki that either launches an application or gives it focus if it is already running.

I have modified the script a little and created a second one for Thunar. In my version, it moves the open instance of Thunar or the terminal to the current desktop (rather than moving me to the desktop where that window currently is running). You can find my Thunar script here, and my Terminal script here. If you would like to open a new Terminal/Thunar window if there is none on the current desktop, instead of moving the existing window to the current desktop, replace the last line of the script with $terminal_exec & or $thunar_exec &. Note that you need to have wmctrl installed to use this script (it should be in the repositories of most distributions).

Make the script executable (chmod +x path to the script) and assign a keybinding to it. I bound these two scripts to the keys I normally use to launch the xfce4-terminal and Thunar (Mod4+F3 and Mod4+F4). It speeds everything up enormously, since I no longer have to wait for the application to launch (or go looking for it among my open windows).

Thank you very much, Vaughn! This is a great tool 😀