1.1 --- a/README.txt Mon Aug 27 19:34:27 2007 +0000
1.2 +++ b/README.txt Mon Aug 27 22:28:31 2007 +0000
1.3 @@ -51,7 +51,7 @@
1.4 New in desktop 0.2.4 (Changes since desktop 0.2.3)
1.5 --------------------------------------------------
1.6
1.7 - * Added XFCE support.
1.8 + * Added XFCE support (with advice from Miki Tebeka).
1.9 * Added Ubuntu Feisty (7.04) package support.
1.10
1.11 New in desktop 0.2.3 (Changes since desktop 0.2.2)
2.1 --- a/desktop.py Mon Aug 27 19:34:27 2007 +0000
2.2 +++ b/desktop.py Mon Aug 27 22:28:31 2007 +0000
2.3 @@ -112,6 +112,24 @@
2.4
2.5 import commands
2.6
2.7 +# Private functions.
2.8 +
2.9 +def _is_xfce():
2.10 +
2.11 + "Return whether XFCE is in use."
2.12 +
2.13 + # XFCE detection involves testing the output of a program.
2.14 +
2.15 + try:
2.16 + if not os.environ.get("DISPLAY", "").strip():
2.17 + vars = "DISPLAY=:0.0 "
2.18 + else:
2.19 + vars = ""
2.20 + return _readfrom(vars + "xprop -root _DT_SAVE_MODE", shell=1).endswith(' = "xfce4"')
2.21 +
2.22 + except OSError:
2.23 + return 0
2.24 +
2.25 # Introspection functions.
2.26
2.27 def get_desktop():
2.28 @@ -131,14 +149,8 @@
2.29 return "Mac OS X"
2.30 elif hasattr(os, "startfile"):
2.31 return "Windows"
2.32 -
2.33 - # XFCE detection involves testing the output of a program.
2.34 -
2.35 - try:
2.36 - if _readfrom("xprop -root _DT_SAVE_MODE", shell=0).endswith(' = "xfce4"'):
2.37 - return "XFCE"
2.38 - except OSError:
2.39 - pass
2.40 + elif _is_xfce():
2.41 + return "XFCE"
2.42
2.43 # XFCE runs on X11, so we have to test for X11 last.
2.44