From 4f282b61cb19160f035746db2326c0e92bdb36fb Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 24 Oct 2023 10:06:36 +0800 Subject: [PATCH] fix: use `WAYLAND_DISPLAY` and `DISPLAY` to detect X11/Wayland when `XDG_SESSION_TYPE` is not set --- yazi-adaptor/src/adaptor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yazi-adaptor/src/adaptor.rs b/yazi-adaptor/src/adaptor.rs index c0fe2122..cc1afbcf 100644 --- a/yazi-adaptor/src/adaptor.rs +++ b/yazi-adaptor/src/adaptor.rs @@ -61,6 +61,11 @@ impl Adaptor { "wayland" => return Self::Wayland, _ => {} } + if env::var_os("WAYLAND_DISPLAY").filter(|s| !s.is_empty()).is_some() { + return Self::Wayland; + } + if env::var_os("DISPLAY").filter(|s| !s.is_empty()).is_some() { + return Self::X11; if std::fs::symlink_metadata("/proc/sys/fs/binfmt_misc/WSLInterop").is_ok() { return Self::Kitty; }