summaryrefslogtreecommitdiff
path: root/portato/helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'portato/helper.py')
-rw-r--r--portato/helper.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/portato/helper.py b/portato/helper.py
index d3fc70b..5b275d6 100644
--- a/portato/helper.py
+++ b/portato/helper.py
@@ -151,3 +151,22 @@ def unique_array(s):
if x not in u:
u.append(x)
return u
+
+def detect_desktop_environment():
+ # stolen from wicd :)
+
+ desktop_environment = 'generic'
+ if os.environ.get('KDE_FULL_SESSION') == 'true':
+ desktop_environment = 'kde'
+ elif os.environ.get('GNOME_DESKTOP_SESSION_ID'):
+ desktop_environment = 'gnome'
+ #else: # no need for this part as of now
+ # try:
+ # info = commands.getoutput('xprop -root _DT_SAVE_MODE')
+ # if ' = "xfce4"' in info:
+ # desktop_environment = 'xfce'
+ # except (OSError, RuntimeError):
+ # pass
+
+ return desktop_environment
+