Go to the first, previous, next, last section, table of contents.


inspect_plwm

This utility is used to connect to the inspect server of a running window manager. The client must be able to connect to the display that the window manager is running on to be able to connect to the inspect server. The display is fetched from the $DISPLAY variable or the command line option -display.

When successfully connected, a welcome message is displayed by the window manager and a common Python prompt is shown. Python expressions and statements can now be entered. They will be evaluated in the window manager, and the results or tracebacks will be printed.

The code will be evalated in an environment containing all builtin functions and the variable wm, which points to the WindowManager object representing the window manager.

An example session (long lines have been wrapped):

[petli@sid petli]$ inspect_plwm 
Welcome to PLWM at :0
>>> wm
<__main__.PLWM instance at 82148a8>
>>> wm.default_screen.clients.values()
[<__main__.MyClient instance at 822ec28>,
 <__main__.MyClient instance at 8215ce8>,
 <__main__.MyClient instance at 8217370>,
 <__main__.MyClient instance at 822bfc0>]
>>> import sys
>>> map(lambda c: sys.stdout.write(c.get_title() + '\n'),
         wm.default_screen.clients.values())
xterm
xterm
WMManager
emacs@sid.cendio.se
[None, None, None, None]
>>>

Note that modules can be imported, and that sys.stdout and sys.stderr will output in the terminal window inspect_plwm is running in, even though the expressions are evaluated inside the window manager.

Multi-line statements can also be written with a small kludge: The lines must start with exactly one space, and one signals that the suite is finished by entering an empty line (without any space at all). Example:

>>>  for c in wm.default_screen.clients.values():
...    print c.get_title(), c.geometry()
... 
xterm (516, 30, 502, 732, 3)
xterm (0, 30, 508, 732, 3)
WMManager (100, 0, 63, 71, 3)
emacs@sid.cendio.se (192, 18, 632, 744, 3)
>>>


Go to the first, previous, next, last section, table of contents.