aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 991f4ec..8c69a59 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -152,3 +152,27 @@ get_desktop_name (void)
return desktop_name;
}
+
+const char*
+get_desktop_session (void)
+{
+ static const char * desktop_session = NULL;
+ const char * xdg_desktop_session;
+
+ if (desktop_session == NULL)
+ {
+ xdg_desktop_session = g_getenv ("XDG_DESKTOP_SESSION");
+
+ if (xdg_desktop_session == NULL)
+ {
+ /* try DESKTOP_SESSION env var if XDG_DESKTOP_SESSION is unset */
+ desktop_session = g_getenv ("DESKTOP_SESSION");
+ }
+ else
+ {
+ desktop_session = xdg_desktop_session;
+ }
+ }
+
+ return desktop_session;
+}