From 3a649493eafb0ea8c7aaaa2c476d2a51985d1b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 17 Oct 2021 18:18:15 +0800 Subject: [PATCH] Don't print `error: XDG_RUNTIME_DIR not set in the environment.` when $XDG_RUNTIME_DIR is not set According to [the manpage](https://manpages.debian.org/experimental/libwayland-doc/wl_display_connect.3.en.html), $XDG_RUNTIME_DIR must be set before calling `wl_display_connect(NULL)`. Otherwise `wl_display_connect` will always fail, and print the error message --- src/modules/resolution.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/resolution.c b/src/modules/resolution.c index 9a1375e46..2add70394 100644 --- a/src/modules/resolution.c +++ b/src/modules/resolution.c @@ -442,6 +442,9 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u static bool printResolutionWaylandBackend(FFinstance* instance) { + if(getenv("XDG_RUNTIME_DIR") == NULL) + return false; + const char* sessionType = getenv("XDG_SESSION_TYPE"); if(sessionType != NULL && strcasecmp(sessionType, "wayland") != 0) return false;