Globals/__init__.py

changeset 6289
f481df37413c
parent 6048
82ad8ec9548c
child 6303
ec9ebaf206fb
--- a/Globals/__init__.py	Sun May 13 14:58:23 2018 +0200
+++ b/Globals/__init__.py	Mon May 14 19:40:29 2018 +0200
@@ -43,7 +43,7 @@
     
     @return flag indicating Windows platform (boolean)
     """
-    return sys.platform.startswith("win")
+    return sys.platform.startswith(("win", "cygwin"))
 
 
 def isMacPlatform():
@@ -64,6 +64,32 @@
     return sys.platform.startswith("linux")
 
 
+def desktopName():
+    """
+    Function to determine the name of the desktop environment used
+    (Linux only).
+    
+    @return name of the desktop environment
+    @rtype str
+    """
+    if not isLinuxPlatform():
+        return ""
+    
+    currDesktop = os.environ.get("XDG_CURRENT_DESKTOP", "")
+    if currDesktop:
+        return currDesktop
+    
+    currDesktop = os.environ.get("XDG_SESSION_DESKTOP", "")
+    if currDesktop:
+        return currDesktop
+    
+    currDesktop = os.environ.get("GDMSESSION", "")
+    if currDesktop:
+        return currDesktop
+    
+    return ""
+
+
 def checkBlacklistedVersions():
     """
     Module functions to check for blacklisted versions of the prerequisites.

eric ide

mercurial