# HG changeset patch # User paulb # Date 1159996914 0 # Node ID a5b25adcb8d4533eb552e40d79f7e68aa7599fea # Parent c347f41a3c352f97dd3fb82fe150c311f5023db7 [project @ 2006-10-04 21:21:54 by paulb] Added XFCE support. Updated release notes. diff -r c347f41a3c35 -r a5b25adcb8d4 README.txt --- a/README.txt Wed Oct 04 20:50:35 2006 +0000 +++ b/README.txt Wed Oct 04 21:21:54 2006 +0000 @@ -8,6 +8,16 @@ http://www.python.org/sf?id=1301512 +Some ideas for desktop detection (XFCE) and URL opening (XFCE, X11) were +obtained from the xdg-utils project which seeks to implement programs +performing similar functions to those found in the desktop module. The +xdg-utils project can be found here: + +http://portland.freedesktop.org/ + +Other information regarding desktop icons and menus, screensavers and MIME +configuration can also be found in xdg-utils. + Contact, Copyright and Licence Information ------------------------------------------ @@ -33,9 +43,16 @@ GNOME Supports file and URL opening using gnome-open. +XFCE Supports file and URL opening using exo-open. + ROX-Filer Supports file opening using "rox " but not URL opening. +New in desktop 0.2.4 (Changes since desktop 0.2.3) +-------------------------------------------------- + + * Added XFCE support. + New in desktop 0.2.3 (Changes since desktop 0.2.2) -------------------------------------------------- diff -r c347f41a3c35 -r a5b25adcb8d4 desktop.py --- a/desktop.py Wed Oct 04 20:50:35 2006 +0000 +++ b/desktop.py Wed Oct 04 21:21:54 2006 +0000 @@ -131,7 +131,18 @@ return "Mac OS X" elif hasattr(os, "startfile"): return "Windows" - elif os.environ.has_key("DISPLAY"): + + # XFCE detection involves testing the output of a program. + + try: + if _readfrom("xprop -root _DT_SAVE_MODE", shell=0).endswith(' = "xfce4"'): + return "XFCE" + except OSError: + pass + + # XFCE runs on X11, so we have to test for X11 last. + + if os.environ.has_key("DISPLAY"): return "X11" else: return None @@ -162,6 +173,8 @@ return "KDE" elif (desktop or detected) == "GNOME": return "GNOME" + elif (desktop or detected) == "XFCE": + return "XFCE" elif (desktop or detected) == "Mac OS X": return "Mac OS X" elif (desktop or detected) == "X11": @@ -188,10 +201,11 @@ particular desktop environment's mechanisms to open the 'url' instead of guessing or detecting which environment is being used. - Suggested values for 'desktop' are "standard", "KDE", "GNOME", "Mac OS X", - "Windows" where "standard" employs a DESKTOP_LAUNCH environment variable to - open the specified 'url'. DESKTOP_LAUNCH should be a command, possibly - followed by arguments, and must have any special characters shell-escaped. + Suggested values for 'desktop' are "standard", "KDE", "GNOME", "XFCE", + "Mac OS X", "Windows" where "standard" employs a DESKTOP_LAUNCH environment + variable to open the specified 'url'. DESKTOP_LAUNCH should be a command, + possibly followed by arguments, and must have any special characters + shell-escaped. The process identifier of the "opener" (ie. viewer, editor, browser or program) associated with the 'url' is returned by this function. If the @@ -221,9 +235,15 @@ elif desktop_in_use == "GNOME": cmd = ["gnome-open", url] + elif desktop_in_use == "XFCE": + cmd = ["exo-open", url] + elif desktop_in_use == "Mac OS X": cmd = ["open", url] + elif desktop_in_use == "X11" and os.environ.has_key("BROWSER"): + cmd = [os.environ["BROWSER"], url] + # Finish with an error where no suitable desktop was identified. else: