diff --git a/glfw/ibus_glfw.c b/glfw/ibus_glfw.c index cd01af002..0d33970fd 100644 --- a/glfw/ibus_glfw.c +++ b/glfw/ibus_glfw.c @@ -286,7 +286,7 @@ get_ibus_address_file_name(void) { const char *host = "unix"; // See https://github.com/ibus/ibus/commit/8ce25208c3f4adfd290a032c6aa739d2b7580eb1 for why we need this dance. const char *de = getenv("WAYLAND_DISPLAY"); - if (de) { + if (de && de[0]) { disp_num = de; } else { const char *de = getenv("DISPLAY"); diff --git a/glfw/x11_init.c b/glfw/x11_init.c index c1b275c75..554fb1e66 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -708,7 +708,7 @@ _glfwPlatformInit(bool *supports_window_occlusion) { _glfw.x11.display = XOpenDisplay(NULL); if (!_glfw.x11.display) { const char *display = getenv("DISPLAY"); - if (display) { + if (display && display[0]) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to open display %s", display); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: The DISPLAY environment variable is missing"); diff --git a/kitty/constants.py b/kitty/constants.py index 86862874f..79c847fea 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -220,9 +220,9 @@ def glfw_path(module: str) -> str: def detect_if_wayland_ok() -> bool: - if 'WAYLAND_DISPLAY' not in os.environ and 'WAYLAND_SOCKET' not in os.environ: + if not os.environ.get('WAYLAND_DISPLAY') and not os.environ.get('WAYLAND_SOCKET'): return False - if 'KITTY_DISABLE_WAYLAND' in os.environ: + if os.environ.get('KITTY_DISABLE_WAYLAND'): return False wayland = glfw_path('wayland') if not os.path.exists(wayland):