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:
pass
elif button == 3:
os.system("osmo &")
elif button == 4:
pp.showDesktop()
elif button == 5:
pp.showDesktop()
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.
Just some curiosity… have u ever see the amount of memory used by pypanel? It seems to use almost the same openbox uses… I’ve used it before. Not anymore. But good tips! So exclusive! As always! Keep up your good work. 🙂
Thanks for sharing these tips. 🙂 Do you know of any way (or patch) that allows you to change the colour of individual parts of the clock, such as hours or minutes?
@ pibarnas: Didn’t know that pypanel used that much memory. Is there a panel that uses less?
N.N., I haven’t seen a patch for that, and I don’t think it is possible.
Excellent. dzen2 and your calendar script were just what I was looking for.
thanx : )
Thanks, great tip, saved me a lot of hassle :).
Awesome script! I’ve added a small part to this for for my own use, that checks if dzen2 is running first, so you can click the tray once to have the calendar appear, then click again to have it disappear:
SERVICE=’dzen2′
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
killall dzen2
else
and a “fi” as the last line
I’ve also removed centering from dzen2, as it skews results if the week has less than 7 days, and added a sed line to fix up monospacing
My calendar script is here:
http://urukrama.pastebin.com/f99d6e4
[…] esto lo vi en el blog de urukrama, la idea es usar dzen2 para mostrar un calendario al presionar el reloj del panel, para esto […]
this panel is complete garbage and out of date….
[…] ~/.conkyrc ~/.conky/gmail.py ~/.conky/weather.sh ~/Files/System/Scripts/dzen_calendar (Taken from urukrama) ~/Files/System/Scripts/themeinfo.py (Taken from […]