libobs: Add desktop session type to Linux log

Add the content of the XDG_SESSION_TYPE environment variable to
the output log if it is set. This is usually set on modern Linux
distributions and typically carry either "x11" or "wayland" when
run from a desktop environment.

This is independent from the QT_QPA_PLATFORM environment variable
which would allow OBS Studio to run inside a wayland session. The
session type it runs on does have an implication on the behavior of
some plugins like screen and window capture. So having this
information exposed here is extremely helpful for diagnosing
issues.
This commit is contained in:
Florian Zwoch 2020-10-27 11:03:21 +01:00 committed by Jim
parent 1920571fdf
commit 0c39fd08c7

View File

@ -312,6 +312,14 @@ static void log_distribution_info(void)
dstr_free(&distro);
free(line);
}
static void log_desktop_session_info(void)
{
char *session_ptr = getenv("XDG_SESSION_TYPE");
if (session_ptr) {
blog(LOG_INFO, "Session Type: %s", session_ptr);
}
}
#endif
void log_system_info(void)
@ -324,6 +332,7 @@ void log_system_info(void)
log_kernel_version();
#if defined(__linux__)
log_distribution_info();
log_desktop_session_info();
#endif
log_x_info();
}