login: add public sd_session_get_desktop() API
The desktop brand is stored as DESKTOP variable for sessions. It can be set arbitrarily by the session owner and identifies the desktop environment that is running on that session.
This commit is contained in:
@@ -153,6 +153,11 @@ global:
|
||||
sd_machine_get_ifindices;
|
||||
} LIBSYSTEMD_214;
|
||||
|
||||
LIBSYSTEMD_217 {
|
||||
global:
|
||||
sd_session_get_desktop;
|
||||
} LIBSYSTEMD_216;
|
||||
|
||||
m4_ifdef(`ENABLE_KDBUS',
|
||||
LIBSYSTEMD_FUTURE {
|
||||
global:
|
||||
@@ -438,5 +443,5 @@ global:
|
||||
/* sd-path */
|
||||
sd_path_home;
|
||||
sd_path_search;
|
||||
} LIBSYSTEMD_216;
|
||||
} LIBSYSTEMD_217;
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user