Log important env vars on startup

This commit is contained in:
Drew DeVault 2016-10-27 10:37:16 -04:00
parent de074b9347
commit 0d6cbcacbe

View file

@ -75,6 +75,32 @@ void run_as_ipc_client(char *command, char *socket_path) {
close(socketfd); close(socketfd);
} }
static void log_env() {
const char *log_vars[] = {
"PATH",
"LD_LOAD_PATH",
"LD_PRELOAD_PATH",
"SWAY_CURSOR_THEME",
"SWAY_CURSOR_SIZE",
"SWAYSOCK",
"WLC_DRM_DEVICE",
"WLC_SHM",
"WLC_OUTPUTS",
"WLC_XWAYLAND",
"WLC_LIBINPUT",
"WLC_REPEAT_DELAY",
"WLC_REPEAT_RATE",
"XKB_DEFAULT_RULES",
"XKB_DEFAULT_MODEL",
"XKB_DEFAULT_LAYOUT",
"XKB_DEFAULT_VARIANT",
"XKB_DEFAULT_OPTIONS",
};
for (size_t i = 0; i < sizeof(log_vars) / sizeof(char *); ++i) {
sway_log(L_INFO, "%s=%s", log_vars[i], getenv(log_vars[i]));
}
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
static int verbose = 0, debug = 0, validate = 0; static int verbose = 0, debug = 0, validate = 0;
@ -210,6 +236,7 @@ int main(int argc, char **argv) {
#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE #if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
#endif #endif
log_env();
init_layout(); init_layout();