From: TAL Date: Sun, 9 Dec 2018 00:32:34 +0000 (+0100) Subject: Fix #3535 - Check for DISPLAY when requesting version information X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=b479dc1a0f1b535f918445c4224373d8d172d7a2 Fix #3535 - Check for DISPLAY when requesting version information --- diff --git a/src/display_version.c b/src/display_version.c index 2e05cafa..da11bff3 100644 --- a/src/display_version.c +++ b/src/display_version.c @@ -55,6 +55,13 @@ static yajl_callbacks version_callbacks = { * */ void display_running_version(void) { + if (getenv("DISPLAY") == NULL) { + fprintf(stderr, "\nYour DISPLAY environment variable is not set.\n"); + fprintf(stderr, "Are you running i3 via SSH or on a virtual console?\n"); + fprintf(stderr, "Try DISPLAY=:0 i3 --moreversion\n"); + exit(EXIT_FAILURE); + } + char *pid_from_atom = root_atom_contents("I3_PID", conn, conn_screen); if (pid_from_atom == NULL) { /* If I3_PID is not set, the running version is older than 4.2-200. */