# HG changeset patch # User paulb # Date 1224105157 0 # Node ID 2b724c10c3dcbf359f866cb9a86df32d5897eccd # Parent b1fb5cce44cc042f90449dbd143effec1f2d6317 [project @ 2008-10-15 21:12:37 by paulb] Updated release information. Fixed root window identification. diff -r b1fb5cce44cc -r 2b724c10c3dc desktop/__init__.py --- a/desktop/__init__.py Wed Oct 15 21:12:21 2008 +0000 +++ b/desktop/__init__.py Wed Oct 15 21:12:37 2008 +0000 @@ -5,7 +5,7 @@ detection and resource opening support for a selection of common and standardised desktop environments. -Copyright (C) 2005, 2006, 2007 Paul Boddie +Copyright (C) 2005, 2006, 2007, 2008 Paul Boddie This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -66,9 +66,15 @@ Details of the DESKTOP_LAUNCH environment variable convention can be found here: http://lists.freedesktop.org/archives/xdg/2004-August/004489.html + +Other Modules +------------- + +The desktop.dialog module provides support for opening dialogue boxes. +The desktop.windows module permits the inspection of desktop windows. """ -__version__ = "0.3" +__version__ = "0.3.1" import os import sys diff -r b1fb5cce44cc -r 2b724c10c3dc desktop/windows.py --- a/desktop/windows.py Wed Oct 15 21:12:21 2008 +0000 +++ b/desktop/windows.py Wed Oct 15 21:12:37 2008 +0000 @@ -72,11 +72,17 @@ def __repr__(self): return "Window(%r)" % self.identifier + def _get_identifier(self): + if self.identifier is None: + return "-root" + else: + return "-id " + self.identifier + def children(self): "Return a list of windows which are children of this window." - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -children" % self.identifier, shell=1) + s = _readfrom(_get_x11_vars() + "xwininfo %s -children" % self._get_identifier(), shell=1) handles = [] adding = 0 for line in s.split("\n"): @@ -90,7 +96,7 @@ "Return the name of the window." - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1) + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1) for line in s.split("\n"): if line.startswith("xwininfo:"): @@ -110,7 +116,7 @@ "Return a tuple containing the width and height of this window." - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1) + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1) d = _xwininfo(s) return _get_int_properties(d, ["Width", "Height"]) @@ -118,7 +124,7 @@ "Return a tuple containing the upper left co-ordinates of this window." - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1) + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1) d = _xwininfo(s) return _get_int_properties(d, ["Absolute upper-left X", "Absolute upper-left Y"]) @@ -137,7 +143,10 @@ s = _readfrom(_get_x11_vars() + "xlsclients -a -l", shell=1) prefix = "Window " prefix_end = len(prefix) - handles = [] + + # Include the root window. + + handles = [None] for line in s.split("\n"): if line.startswith(prefix):