[Python-xlib-users] Obtaining A Window Given Its Title

Hello all,
I'm currently doing some work relating to OpenOffice.org. Sadly, their
API doesn't allow me the level of control over the low-level windowing
stuff (Z-order and opacity, specifically) that I need to get the job
done. The obvious place to look is Xlib.
So, I can set a limited number of things from the OO.o API, one of them
being the title of the window. Is it possible to get a Window object,
in python-xlib terms, given just the title?
At the moment, I'm looking at using Window.query_tree on the top window
on the default screen of the default display to get a list of windows,
and then match against that. Unfortunately, I get the list of windows,
but am then at a loss as to how to do the comparison.
Can anyone help me out?
Thanks,
Dan
--
credativ ltd UK office: +44 1788 298150
PO Box 3868 Direct ext: +44 1788 298152
Rugby Email: daniel.watkins@...
CV21 3WW Web: http://www.credativ.co.uk/
credativ limited is registered in England & Wales, company no. 5261743
registered office: Suite 2 Bloxam Court, Corporation Street, Rugby CV21
2DU

Thread view

Hello all,
I'm currently doing some work relating to OpenOffice.org. Sadly, their
API doesn't allow me the level of control over the low-level windowing
stuff (Z-order and opacity, specifically) that I need to get the job
done. The obvious place to look is Xlib.
So, I can set a limited number of things from the OO.o API, one of them
being the title of the window. Is it possible to get a Window object,
in python-xlib terms, given just the title?
At the moment, I'm looking at using Window.query_tree on the top window
on the default screen of the default display to get a list of windows,
and then match against that. Unfortunately, I get the list of windows,
but am then at a loss as to how to do the comparison.
Can anyone help me out?
Thanks,
Dan
--
credativ ltd UK office: +44 1788 298150
PO Box 3868 Direct ext: +44 1788 298152
Rugby Email: daniel.watkins@...
CV21 3WW Web: http://www.credativ.co.uk/
credativ limited is registered in England & Wales, company no. 5261743
registered office: Suite 2 Bloxam Court, Corporation Street, Rugby CV21
2DU

On Tue, 07 Oct 2008 14:54:27 +0100 Daniel Watkins <daniel.watkins@...> wrote:
> So, I can set a limited number of things from the OO.o API, one of them
> being the title of the window. Is it possible to get a Window object,
> in python-xlib terms, given just the title?
In general, no. This isn't a python-xlib issue, it's an X
issue. There's no guarantee that a title is unique.
> At the moment, I'm looking at using Window.query_tree on the top window
> on the default screen of the default display to get a list of windows,
> and then match against that. Unfortunately, I get the list of windows,
> but am then at a loss as to how to do the comparison.
That returns a list of Window objects as the children attribute. You
can use their get_wm_name method to check the titles on them.
However, if you can get the window id from oo, that would be a better
thing to check for.
<mike
--
Mike Meyer <mwm@...> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
O< ascii ribbon campaign - stop html mail - http://www.asciiribbon.org