views:

24

answers:

1

I have an application written in python, I would like it to be able to "minimize" to the gnome panel, much like how gnome's rhytmbox minimizes to the panel. Is it easily possible to do this?

I've run the examples from here but failed to get any of them working and those don't seem to be exactly what I'm looking for. Any good places to start?

+1  A: 

The examples linked show how to write panel applets, which have been somewhat discouraged for a while now. Instead, you probably want to create a gtk.StatusIcon. Status icons require the user to have a system tray, but given their widespread use that covers just about everyone.

Once you've got your status icon, minimizing to the panel is a simple matter of:

  • showing/hiding your application window when the icon is clicked, probably in the StatusIcon's activate signal handler; and
  • listen to window-state-event on your window, intercepting iconify changes so that you can hide your window instead of it being shown in the taskbar

Of course, using a status icon like this isn't really recommended from a UI point of view, but it is the most pragmatic solution currently.

Kai
That's absolutely what I was looking for, thank you.
EricR