1.1 --- a/desktop.py Wed Oct 04 20:50:35 2006 +0000
1.2 +++ b/desktop.py Wed Oct 04 21:21:54 2006 +0000
1.3 @@ -131,7 +131,18 @@
1.4 return "Mac OS X"
1.5 elif hasattr(os, "startfile"):
1.6 return "Windows"
1.7 - elif os.environ.has_key("DISPLAY"):
1.8 +
1.9 + # XFCE detection involves testing the output of a program.
1.10 +
1.11 + try:
1.12 + if _readfrom("xprop -root _DT_SAVE_MODE", shell=0).endswith(' = "xfce4"'):
1.13 + return "XFCE"
1.14 + except OSError:
1.15 + pass
1.16 +
1.17 + # XFCE runs on X11, so we have to test for X11 last.
1.18 +
1.19 + if os.environ.has_key("DISPLAY"):
1.20 return "X11"
1.21 else:
1.22 return None
1.23 @@ -162,6 +173,8 @@
1.24 return "KDE"
1.25 elif (desktop or detected) == "GNOME":
1.26 return "GNOME"
1.27 + elif (desktop or detected) == "XFCE":
1.28 + return "XFCE"
1.29 elif (desktop or detected) == "Mac OS X":
1.30 return "Mac OS X"
1.31 elif (desktop or detected) == "X11":
1.32 @@ -188,10 +201,11 @@
1.33 particular desktop environment's mechanisms to open the 'url' instead of
1.34 guessing or detecting which environment is being used.
1.35
1.36 - Suggested values for 'desktop' are "standard", "KDE", "GNOME", "Mac OS X",
1.37 - "Windows" where "standard" employs a DESKTOP_LAUNCH environment variable to
1.38 - open the specified 'url'. DESKTOP_LAUNCH should be a command, possibly
1.39 - followed by arguments, and must have any special characters shell-escaped.
1.40 + Suggested values for 'desktop' are "standard", "KDE", "GNOME", "XFCE",
1.41 + "Mac OS X", "Windows" where "standard" employs a DESKTOP_LAUNCH environment
1.42 + variable to open the specified 'url'. DESKTOP_LAUNCH should be a command,
1.43 + possibly followed by arguments, and must have any special characters
1.44 + shell-escaped.
1.45
1.46 The process identifier of the "opener" (ie. viewer, editor, browser or
1.47 program) associated with the 'url' is returned by this function. If the
1.48 @@ -221,9 +235,15 @@
1.49 elif desktop_in_use == "GNOME":
1.50 cmd = ["gnome-open", url]
1.51
1.52 + elif desktop_in_use == "XFCE":
1.53 + cmd = ["exo-open", url]
1.54 +
1.55 elif desktop_in_use == "Mac OS X":
1.56 cmd = ["open", url]
1.57
1.58 + elif desktop_in_use == "X11" and os.environ.has_key("BROWSER"):
1.59 + cmd = [os.environ["BROWSER"], url]
1.60 +
1.61 # Finish with an error where no suitable desktop was identified.
1.62
1.63 else: