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:
elif button == 2:
elif button == 3:
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.