mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: compositors not supported by Überzug Wayland layer, or WSL not with WezTerm should fallback to Chafa (#1735)
This commit is contained in:
parent
3321f47d46
commit
491f8b8fb1
2 changed files with 11 additions and 8 deletions
|
|
@ -83,9 +83,10 @@ impl Adapter {
|
||||||
impl Adapter {
|
impl Adapter {
|
||||||
pub fn matches() -> Self {
|
pub fn matches() -> Self {
|
||||||
let emulator = Emulator::detect();
|
let emulator = Emulator::detect();
|
||||||
#[cfg(windows)]
|
|
||||||
if matches!(emulator, Emulator::Microsoft) {
|
if matches!(emulator, Emulator::Microsoft) {
|
||||||
return Self::Sixel;
|
return Self::Sixel;
|
||||||
|
} else if *WSL && matches!(emulator, Emulator::WezTerm) {
|
||||||
|
return Self::KgpOld;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut protocols = emulator.adapters();
|
let mut protocols = emulator.adapters();
|
||||||
|
|
@ -104,18 +105,15 @@ impl Adapter {
|
||||||
match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() {
|
match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() {
|
||||||
"x11" => return Self::X11,
|
"x11" => return Self::X11,
|
||||||
"wayland" if supported_compositor => return Self::Wayland,
|
"wayland" if supported_compositor => return Self::Wayland,
|
||||||
"wayland" if !supported_compositor => warn!("[Adapter] Unsupported Wayland compositor"),
|
"wayland" if !supported_compositor => return Self::Chafa,
|
||||||
_ => warn!("[Adapter] Could not identify XDG_SESSION_TYPE"),
|
_ => warn!("[Adapter] Could not identify XDG_SESSION_TYPE"),
|
||||||
}
|
}
|
||||||
if supported_compositor && env_exists("WAYLAND_DISPLAY") {
|
if env_exists("WAYLAND_DISPLAY") {
|
||||||
return Self::Wayland;
|
return if supported_compositor { Self::Wayland } else { Self::Chafa };
|
||||||
}
|
}
|
||||||
if env_exists("DISPLAY") {
|
if env_exists("DISPLAY") {
|
||||||
return Self::X11;
|
return Self::X11;
|
||||||
}
|
}
|
||||||
if *WSL {
|
|
||||||
return Self::KgpOld;
|
|
||||||
}
|
|
||||||
|
|
||||||
warn!("[Adapter] Falling back to chafa");
|
warn!("[Adapter] Falling back to chafa");
|
||||||
Self::Chafa
|
Self::Chafa
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,12 @@ function M:preload()
|
||||||
end
|
end
|
||||||
|
|
||||||
local cache = ya.file_cache(self)
|
local cache = ya.file_cache(self)
|
||||||
if not cache or fs.cha(cache) then
|
if not cache then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local cha = fs.cha(cache)
|
||||||
|
if cha and cha.length > 0 then
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue