18 (Linux only). |
18 (Linux only). |
19 |
19 |
20 @return name of the desktop environment |
20 @return name of the desktop environment |
21 @rtype str |
21 @rtype str |
22 """ |
22 """ |
23 if OSUtilities.isLinuxPlatform(): |
23 if OSUtilities.isLinuxPlatform() or OSUtilities.isBsdPlatform(): |
24 currDesktop = os.environ.get("XDG_CURRENT_DESKTOP", "") |
24 currDesktop = os.environ.get("XDG_CURRENT_DESKTOP", "") |
25 if currDesktop: |
25 if currDesktop: |
26 return currDesktop |
26 return currDesktop |
27 |
27 |
28 currDesktop = os.environ.get("XDG_SESSION_DESKTOP", "") |
28 currDesktop = os.environ.get("XDG_SESSION_DESKTOP", "") |
56 Function to check, if the current session is a KDE desktop (Linux only). |
56 Function to check, if the current session is a KDE desktop (Linux only). |
57 |
57 |
58 @return flag indicating a KDE desktop |
58 @return flag indicating a KDE desktop |
59 @rtype bool |
59 @rtype bool |
60 """ |
60 """ |
61 if OSUtilities.isLinuxPlatform(): |
61 if OSUtilities.isLinuxPlatform() or OSUtilities.isBsdPlatform(): |
62 desktop = ( |
62 desktop = ( |
63 os.environ.get("XDG_CURRENT_DESKTOP", "").lower() |
63 os.environ.get("XDG_CURRENT_DESKTOP", "").lower() |
64 or os.environ.get("XDG_SESSION_DESKTOP", "").lower() |
64 or os.environ.get("XDG_SESSION_DESKTOP", "").lower() |
65 or os.environ.get("DESKTOP_SESSION", "").lower() |
65 or os.environ.get("DESKTOP_SESSION", "").lower() |
66 ) |
66 ) |
78 Function to check, if the current session is a Gnome desktop (Linux only). |
78 Function to check, if the current session is a Gnome desktop (Linux only). |
79 |
79 |
80 @return flag indicating a Gnome desktop |
80 @return flag indicating a Gnome desktop |
81 @rtype bool |
81 @rtype bool |
82 """ |
82 """ |
83 if OSUtilities.isLinuxPlatform(): |
83 if OSUtilities.isLinuxPlatform() or OSUtilities.isBsdPlatform(): |
84 desktop = ( |
84 desktop = ( |
85 os.environ.get("XDG_CURRENT_DESKTOP", "").lower() |
85 os.environ.get("XDG_CURRENT_DESKTOP", "").lower() |
86 or os.environ.get("XDG_SESSION_DESKTOP", "").lower() |
86 or os.environ.get("XDG_SESSION_DESKTOP", "").lower() |
87 or os.environ.get("GDMSESSION", "").lower() |
87 or os.environ.get("GDMSESSION", "").lower() |
88 ) |
88 ) |
100 Function to determine the name of the running session (Linux only). |
100 Function to determine the name of the running session (Linux only). |
101 |
101 |
102 @return name of the desktop environment |
102 @return name of the desktop environment |
103 @rtype str |
103 @rtype str |
104 """ |
104 """ |
105 if OSUtilities.isLinuxPlatform(): |
105 if OSUtilities.isLinuxPlatform() or OSUtilities.isBsdPlatform(): |
106 sessionType = os.environ.get("XDG_SESSION_TYPE", "").lower() |
106 sessionType = os.environ.get("XDG_SESSION_TYPE", "").lower() |
107 if "x11" in sessionType: |
107 if "x11" in sessionType: |
108 return "X11" |
108 return "X11" |
109 elif "wayland" in sessionType: |
109 elif "wayland" in sessionType: |
110 return "Wayland" |
110 return "Wayland" |