mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: add Mintty (Git Bash) image preview support (#103)
This commit is contained in:
parent
66aecd5402
commit
25ba265407
4 changed files with 22 additions and 12 deletions
23
README.md
23
README.md
|
|
@ -147,17 +147,18 @@ If you want to use your own config, copy the [config folder](./config/preset) to
|
||||||
|
|
||||||
## Image Preview
|
## Image Preview
|
||||||
|
|
||||||
| Platform | Protocol | Support |
|
| Platform | Protocol | Support |
|
||||||
| ------------- | -------------------------------------------------------------------------------- | --------------------- |
|
| ----------------- | -------------------------------------------------------------------------------- | --------------------- |
|
||||||
| Kitty | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in |
|
| Kitty | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in |
|
||||||
| WezTerm | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in |
|
| WezTerm | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in |
|
||||||
| Konsole | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in |
|
| Konsole | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in |
|
||||||
| iTerm2 | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
| iTerm2 | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
||||||
| Hyper | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in |
|
| Mintty (Git Bash) | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
||||||
| foot | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in |
|
| Hyper | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in |
|
||||||
| Black Box | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in |
|
| foot | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in |
|
||||||
| X11 / Wayland | Window system protocol | ☑️ Überzug++ required |
|
| Black Box | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in |
|
||||||
| Fallback | [Chafa](https://hpjansson.org/chafa/) | ☑️ Überzug++ required |
|
| X11 / Wayland | Window system protocol | ☑️ Überzug++ required |
|
||||||
|
| Fallback | [Chafa](https://hpjansson.org/chafa/) | ☑️ Überzug++ required |
|
||||||
|
|
||||||
Yazi automatically selects the appropriate preview method for you, based on the priority from top to bottom.
|
Yazi automatically selects the appropriate preview method for you, based on the priority from top to bottom.
|
||||||
That's relying on the `$TERM`, `$TERM_PROGRAM`, and `$XDG_SESSION_TYPE` variables, make sure you don't overwrite them by mistake!
|
That's relying on the `$TERM`, `$TERM_PROGRAM`, and `$XDG_SESSION_TYPE` variables, make sure you don't overwrite them by mistake!
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ impl Default for PreviewAdaptor {
|
||||||
"BlackBox" => return Self::Sixel,
|
"BlackBox" => return Self::Sixel,
|
||||||
"vscode" => return Self::Sixel,
|
"vscode" => return Self::Sixel,
|
||||||
"Hyper" => return Self::Sixel,
|
"Hyper" => return Self::Sixel,
|
||||||
|
"mintty" => return Self::Iterm2,
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() {
|
match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"language":"en","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord"],"version":"0.2"}
|
{"language":"en","words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs"],"version":"0.2","flagWords":[]}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,16 @@ impl Term {
|
||||||
{
|
{
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
|
use std::{thread, time::Duration};
|
||||||
|
|
||||||
use crossterm::cursor::{Hide, Show};
|
use crossterm::cursor::{Hide, Show};
|
||||||
queue!(&mut stdout, SavePosition, MoveTo(x, y), Show)?;
|
queue!(&mut stdout, SavePosition, MoveTo(x, y), Show)?;
|
||||||
|
|
||||||
|
// I really don't want to add this,
|
||||||
|
// but on Windows the cursor position will not synchronize in time occasionally
|
||||||
|
stdout.flush()?;
|
||||||
|
thread::sleep(Duration::from_millis(1));
|
||||||
|
|
||||||
let result = cb(&mut stdout);
|
let result = cb(&mut stdout);
|
||||||
queue!(&mut stdout, Hide, RestorePosition)?;
|
queue!(&mut stdout, Hide, RestorePosition)?;
|
||||||
stdout.flush()?;
|
stdout.flush()?;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue