1.1 --- a/README.txt Wed Oct 04 20:50:35 2006 +0000
1.2 +++ b/README.txt Wed Oct 04 21:21:54 2006 +0000
1.3 @@ -8,6 +8,16 @@
1.4
1.5 http://www.python.org/sf?id=1301512
1.6
1.7 +Some ideas for desktop detection (XFCE) and URL opening (XFCE, X11) were
1.8 +obtained from the xdg-utils project which seeks to implement programs
1.9 +performing similar functions to those found in the desktop module. The
1.10 +xdg-utils project can be found here:
1.11 +
1.12 +http://portland.freedesktop.org/
1.13 +
1.14 +Other information regarding desktop icons and menus, screensavers and MIME
1.15 +configuration can also be found in xdg-utils.
1.16 +
1.17 Contact, Copyright and Licence Information
1.18 ------------------------------------------
1.19
1.20 @@ -33,9 +43,16 @@
1.21
1.22 GNOME Supports file and URL opening using gnome-open.
1.23
1.24 +XFCE Supports file and URL opening using exo-open.
1.25 +
1.26 ROX-Filer Supports file opening using "rox <filename>" but not URL
1.27 opening.
1.28
1.29 +New in desktop 0.2.4 (Changes since desktop 0.2.3)
1.30 +--------------------------------------------------
1.31 +
1.32 + * Added XFCE support.
1.33 +
1.34 New in desktop 0.2.3 (Changes since desktop 0.2.2)
1.35 --------------------------------------------------
1.36
2.1 --- a/desktop.py Wed Oct 04 20:50:35 2006 +0000
2.2 +++ b/desktop.py Wed Oct 04 21:21:54 2006 +0000
2.3 @@ -131,7 +131,18 @@
2.4 return "Mac OS X"
2.5 elif hasattr(os, "startfile"):
2.6 return "Windows"
2.7 - elif os.environ.has_key("DISPLAY"):
2.8 +
2.9 + # XFCE detection involves testing the output of a program.
2.10 +
2.11 + try:
2.12 + if _readfrom("xprop -root _DT_SAVE_MODE", shell=0).endswith(' = "xfce4"'):
2.13 + return "XFCE"
2.14 + except OSError:
2.15 + pass
2.16 +
2.17 + # XFCE runs on X11, so we have to test for X11 last.
2.18 +
2.19 + if os.environ.has_key("DISPLAY"):
2.20 return "X11"
2.21 else:
2.22 return None
2.23 @@ -162,6 +173,8 @@
2.24 return "KDE"
2.25 elif (desktop or detected) == "GNOME":
2.26 return "GNOME"
2.27 + elif (desktop or detected) == "XFCE":
2.28 + return "XFCE"
2.29 elif (desktop or detected) == "Mac OS X":
2.30 return "Mac OS X"
2.31 elif (desktop or detected) == "X11":
2.32 @@ -188,10 +201,11 @@
2.33 particular desktop environment's mechanisms to open the 'url' instead of
2.34 guessing or detecting which environment is being used.
2.35
2.36 - Suggested values for 'desktop' are "standard", "KDE", "GNOME", "Mac OS X",
2.37 - "Windows" where "standard" employs a DESKTOP_LAUNCH environment variable to
2.38 - open the specified 'url'. DESKTOP_LAUNCH should be a command, possibly
2.39 - followed by arguments, and must have any special characters shell-escaped.
2.40 + Suggested values for 'desktop' are "standard", "KDE", "GNOME", "XFCE",
2.41 + "Mac OS X", "Windows" where "standard" employs a DESKTOP_LAUNCH environment
2.42 + variable to open the specified 'url'. DESKTOP_LAUNCH should be a command,
2.43 + possibly followed by arguments, and must have any special characters
2.44 + shell-escaped.
2.45
2.46 The process identifier of the "opener" (ie. viewer, editor, browser or
2.47 program) associated with the 'url' is returned by this function. If the
2.48 @@ -221,9 +235,15 @@
2.49 elif desktop_in_use == "GNOME":
2.50 cmd = ["gnome-open", url]
2.51
2.52 + elif desktop_in_use == "XFCE":
2.53 + cmd = ["exo-open", url]
2.54 +
2.55 elif desktop_in_use == "Mac OS X":
2.56 cmd = ["open", url]
2.57
2.58 + elif desktop_in_use == "X11" and os.environ.has_key("BROWSER"):
2.59 + cmd = [os.environ["BROWSER"], url]
2.60 +
2.61 # Finish with an error where no suitable desktop was identified.
2.62
2.63 else: