Update so that WindowsTerminal uses sixel for images previews

This commit is contained in:
Eric Nelson 2024-09-01 11:56:21 -07:00
parent 69e7c8ff0d
commit 921fc0bdae
2 changed files with 12 additions and 6 deletions

View file

@ -82,15 +82,18 @@ 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)]
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;
}

View file

@ -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,