mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Update so that WindowsTerminal uses sixel for images previews
This commit is contained in:
parent
69e7c8ff0d
commit
921fc0bdae
2 changed files with 12 additions and 6 deletions
|
|
@ -82,14 +82,17 @@ impl Adapter {
|
|||
|
||||
impl Adapter {
|
||||
pub fn matches() -> Self {
|
||||
let mut protocols = Emulator::detect().adapters();
|
||||
let emulator = Emulator::detect();
|
||||
let mut protocols = emulator.clone().adapters();
|
||||
|
||||
#[cfg(windows)]
|
||||
protocols.retain(|p| *p == Self::Iterm2);
|
||||
if env_exists("ZELLIJ_SESSION_NAME") {
|
||||
protocols.retain(|p| *p == Self::Sixel);
|
||||
} else if *TMUX {
|
||||
protocols.retain(|p| *p != Self::KittyOld);
|
||||
if !matches!(emulator, Emulator::WindowsTerminal) {
|
||||
protocols.retain(|p| *p == Self::Iterm2);
|
||||
if env_exists("ZELLIJ_SESSION_NAME") {
|
||||
protocols.retain(|p| *p == Self::Sixel);
|
||||
} else if *TMUX {
|
||||
protocols.retain(|p| *p != Self::KittyOld);
|
||||
}
|
||||
}
|
||||
if let Some(p) = protocols.first() {
|
||||
return *p;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ pub enum Emulator {
|
|||
Neovim,
|
||||
Apple,
|
||||
Urxvt,
|
||||
WindowsTerminal
|
||||
}
|
||||
|
||||
impl Emulator {
|
||||
|
|
@ -46,6 +47,7 @@ impl Emulator {
|
|||
Self::Neovim => vec![],
|
||||
Self::Apple => vec![],
|
||||
Self::Urxvt => vec![],
|
||||
Self::WindowsTerminal => vec![Adapter::Sixel]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +66,7 @@ impl Emulator {
|
|||
("GHOSTTY_RESOURCES_DIR", Self::Ghostty),
|
||||
("VSCODE_INJECTION", Self::VSCode),
|
||||
("TABBY_CONFIG_DIRECTORY", Self::Tabby),
|
||||
("WT_Session", Self::WindowsTerminal),
|
||||
];
|
||||
match vars.into_iter().find(|v| env_exists(v.0)) {
|
||||
Some(var) => return var.1,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue