From 8aeef55b6fc5bdaac2b8df4cbee26f990417c6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Tue, 24 Oct 2023 19:34:06 +0800 Subject: [PATCH] feat: support image preview on WSL (#315) --- yazi-adaptor/src/adaptor.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/yazi-adaptor/src/adaptor.rs b/yazi-adaptor/src/adaptor.rs index 73e4aff3..c0fe2122 100644 --- a/yazi-adaptor/src/adaptor.rs +++ b/yazi-adaptor/src/adaptor.rs @@ -57,10 +57,14 @@ impl Adaptor { _ => {} } match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() { - "x11" => Self::X11, - "wayland" => Self::Wayland, - _ => Self::Chafa, + "x11" => return Self::X11, + "wayland" => return Self::Wayland, + _ => {} } + if std::fs::symlink_metadata("/proc/sys/fs/binfmt_misc/WSLInterop").is_ok() { + return Self::Kitty; + } + Self::Chafa } pub(super) fn term_program() -> (String, String) {