summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-login/sd-login.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-login/sd-login.c')
-rw-r--r--src/libsystemd/sd-login/sd-login.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index 95cb6ff581..c72d23ed53 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -485,6 +485,25 @@ _public_ int sd_session_get_class(const char *session, char **class) {
return session_get_string(session, "CLASS", class);
}
+_public_ int sd_session_get_desktop(const char *session, char **desktop) {
+ _cleanup_free_ char *escaped = NULL;
+ char *t;
+ int r;
+
+ assert_return(desktop, -EINVAL);
+
+ r = session_get_string(session, "DESKTOP", &escaped);
+ if (r < 0)
+ return r;
+
+ t = cunescape(escaped);
+ if (!t)
+ return -ENOMEM;
+
+ *desktop = t;
+ return 0;
+}
+
_public_ int sd_session_get_display(const char *session, char **display) {
return session_get_string(session, "DISPLAY", display);
}