1.1 --- a/desktop/windows.py Sat Nov 01 00:04:01 2008 +0100
1.2 +++ b/desktop/windows.py Sun Nov 30 01:17:09 2008 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Simple desktop window enumeration for Python.
1.6
1.7 -Copyright (C) 2007 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 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 @@ -28,6 +28,11 @@
1.13
1.14 windows = desktop.windows.list()
1.15
1.16 +To obtain the root window, typically the desktop background, use the
1.17 +desktop.windows.root function as follows:
1.18 +
1.19 +root = desktop.windows.root()
1.20 +
1.21 Each window object can be inspected through a number of methods. For example:
1.22
1.23 name = window.name()
1.24 @@ -156,4 +161,20 @@
1.25
1.26 return [Window(handle) for handle in handles]
1.27
1.28 +def root(desktop=None):
1.29 +
1.30 + """
1.31 + Return the root window for the current desktop. If the optional 'desktop'
1.32 + parameter is specified then attempt to use that particular desktop
1.33 + environment's mechanisms to look for windows.
1.34 + """
1.35 +
1.36 + # NOTE: The desktop parameter is currently ignored and X11 is tested for
1.37 + # NOTE: directly.
1.38 +
1.39 + if _is_x11():
1.40 + return Window(None)
1.41 + else:
1.42 + raise OSError, "Desktop '%s' not supported" % use_desktop(desktop)
1.43 +
1.44 # vim: tabstop=4 expandtab shiftwidth=4