[pygtk] Setting application name in pygtk?
dieterv at optionexplicit.be
Wed Nov 8 02:26:13 WST 2006
On Tue, 2006-11-07 at 11:08 -0500, Willie Walker wrote:
> Hi Brian:
> Setting the window title works great for the window, but it doesn't set
> the name of the application. :-( That is, if one were to look at the
> hierarchy with an application like at-poke on GNOME, they'd see
> something like this:
> app: "-c"
> window: "my window title here"
> window: "some other window title here"
> It's the "-c" that we're trying to make more human consumable. It looks
> like PyGtk is grabbing arg as a default for the application name.
PyGtk has nothing to do with it. It's the python interpreter which
populates the sys.argv list (1)
> Other than the prctl stuff at http://davyd.livejournal.com/166352.html,
> is there some other way to tell PyGtk to set the app name?
No, not that I'm aware of. There are people who have asked (2) for this
ability to be included with python itself. The patch got rejected and
has since been developed as a standalone module: proctitle...
> In particular, we want to be able to set the app name for ATK so that
> assistive technology clients will get a more human consumable string.
I have no idea where ATK gets it's process name, if it is the same as
sys.argv (likely it is) and if ATK has a function to override this.
> It looks like we might be able to do this *before* the import of gtk:
> import sys
> sys.argv = "Orca"
Doing _only_ this leads to confusion as you are breaking simple commands
like ps or killall. That's why the prctl stuff is necessary.
> I tried this and it seems to work, but I feel a little strange about it.
You should. Read above ;)
> What crimes against humanity am I committing by doing this?
This whole thing is nothing more than a non-portable hack (3). It's up
to you guys if you're willing to use it.
(1) http://docs.python.org/tut/node4.html, 2.1.1 Argument Passing
Actual code proving this here (lines 461-470):
(2) summer of 2002 is the earliest reference i've found:
(3) works on Linux 2.6 from 4 september 2005 and up (4)
(4) similar tricks exist for other OSs. Don't ask, I don't know ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20061107/193aed70/attachment.pgp
More information about the pygtk