1.1 --- a/desktop/__init__.py Wed Oct 15 21:12:21 2008 +0000
1.2 +++ b/desktop/__init__.py Wed Oct 15 21:12:37 2008 +0000
1.3 @@ -5,7 +5,7 @@
1.4 detection and resource opening support for a selection of common and
1.5 standardised desktop environments.
1.6
1.7 -Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2005, 2006, 2007, 2008 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This library is free software; you can redistribute it and/or
1.11 modify it under the terms of the GNU Lesser General Public
1.12 @@ -66,9 +66,15 @@
1.13
1.14 Details of the DESKTOP_LAUNCH environment variable convention can be found here:
1.15 http://lists.freedesktop.org/archives/xdg/2004-August/004489.html
1.16 +
1.17 +Other Modules
1.18 +-------------
1.19 +
1.20 +The desktop.dialog module provides support for opening dialogue boxes.
1.21 +The desktop.windows module permits the inspection of desktop windows.
1.22 """
1.23
1.24 -__version__ = "0.3"
1.25 +__version__ = "0.3.1"
1.26
1.27 import os
1.28 import sys
2.1 --- a/desktop/windows.py Wed Oct 15 21:12:21 2008 +0000
2.2 +++ b/desktop/windows.py Wed Oct 15 21:12:37 2008 +0000
2.3 @@ -72,11 +72,17 @@
2.4 def __repr__(self):
2.5 return "Window(%r)" % self.identifier
2.6
2.7 + def _get_identifier(self):
2.8 + if self.identifier is None:
2.9 + return "-root"
2.10 + else:
2.11 + return "-id " + self.identifier
2.12 +
2.13 def children(self):
2.14
2.15 "Return a list of windows which are children of this window."
2.16
2.17 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -children" % self.identifier, shell=1)
2.18 + s = _readfrom(_get_x11_vars() + "xwininfo %s -children" % self._get_identifier(), shell=1)
2.19 handles = []
2.20 adding = 0
2.21 for line in s.split("\n"):
2.22 @@ -90,7 +96,7 @@
2.23
2.24 "Return the name of the window."
2.25
2.26 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1)
2.27 + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1)
2.28 for line in s.split("\n"):
2.29 if line.startswith("xwininfo:"):
2.30
2.31 @@ -110,7 +116,7 @@
2.32
2.33 "Return a tuple containing the width and height of this window."
2.34
2.35 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1)
2.36 + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1)
2.37 d = _xwininfo(s)
2.38 return _get_int_properties(d, ["Width", "Height"])
2.39
2.40 @@ -118,7 +124,7 @@
2.41
2.42 "Return a tuple containing the upper left co-ordinates of this window."
2.43
2.44 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1)
2.45 + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1)
2.46 d = _xwininfo(s)
2.47 return _get_int_properties(d, ["Absolute upper-left X", "Absolute upper-left Y"])
2.48
2.49 @@ -137,7 +143,10 @@
2.50 s = _readfrom(_get_x11_vars() + "xlsclients -a -l", shell=1)
2.51 prefix = "Window "
2.52 prefix_end = len(prefix)
2.53 - handles = []
2.54 +
2.55 + # Include the root window.
2.56 +
2.57 + handles = [None]
2.58
2.59 for line in s.split("\n"):
2.60 if line.startswith(prefix):