mirror of
https://github.com/sxyazi/yazi.git
synced 2024-11-23 17:32:50 +03:00
refactor: rename crate yazi-adaptor
to yazi-adapter
This commit is contained in:
parent
1166f86523
commit
189cb81db3
@ -40,18 +40,18 @@ Before you begin, ensure you have met the following requirements:
|
|||||||
A brief overview of the project's structure:
|
A brief overview of the project's structure:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
yazi/
|
.
|
||||||
├── assets/ # Assets like images and fonts
|
├── assets/ # Assets like images and fonts
|
||||||
├── nix/ # Nix-related configurations
|
├── nix/ # Nix-related configurations
|
||||||
├── scripts/ # Helper scripts used by CI/CD
|
├── scripts/ # Helper scripts used by CI/CD
|
||||||
├── snap/ # Snapcraft configuration
|
├── snap/ # Snapcraft configuration
|
||||||
├── yazi-adaptor/ # Yazi image adaptor
|
├── yazi-adapter/ # Yazi image adapter
|
||||||
├── yazi-boot/ # Yazi bootstrapper
|
├── yazi-boot/ # Yazi bootstrapper
|
||||||
├── yazi-cli/ # Yazi command-line interface
|
├── yazi-cli/ # Yazi command-line interface
|
||||||
├── yazi-config/ # Yazi configuration file parser
|
├── yazi-config/ # Yazi configuration file parser
|
||||||
├── yazi-core/ # Yazi core logic
|
├── yazi-core/ # Yazi core logic
|
||||||
├── yazi-dds/ # Yazi data distribution service
|
├── yazi-dds/ # Yazi data distribution service
|
||||||
├── yazi-fm/ # Yazi File Manager
|
├── yazi-fm/ # Yazi file manager
|
||||||
├── yazi-plugin/ # Yazi plugin system
|
├── yazi-plugin/ # Yazi plugin system
|
||||||
├── yazi-proxy/ # Yazi event proxy
|
├── yazi-proxy/ # Yazi event proxy
|
||||||
├── yazi-scheduler/ # Yazi task scheduler
|
├── yazi-scheduler/ # Yazi task scheduler
|
||||||
|
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -2690,7 +2690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
|
checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yazi-adaptor"
|
name = "yazi-adapter"
|
||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi-to-tui",
|
"ansi-to-tui",
|
||||||
@ -2722,7 +2722,7 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"vergen",
|
"vergen",
|
||||||
"yazi-adaptor",
|
"yazi-adapter",
|
||||||
"yazi-config",
|
"yazi-config",
|
||||||
"yazi-shared",
|
"yazi-shared",
|
||||||
]
|
]
|
||||||
@ -2786,7 +2786,7 @@ dependencies = [
|
|||||||
"tokio-util",
|
"tokio-util",
|
||||||
"tracing",
|
"tracing",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"yazi-adaptor",
|
"yazi-adapter",
|
||||||
"yazi-boot",
|
"yazi-boot",
|
||||||
"yazi-config",
|
"yazi-config",
|
||||||
"yazi-dds",
|
"yazi-dds",
|
||||||
@ -2835,7 +2835,7 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
"tracing-appender",
|
"tracing-appender",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"yazi-adaptor",
|
"yazi-adapter",
|
||||||
"yazi-boot",
|
"yazi-boot",
|
||||||
"yazi-config",
|
"yazi-config",
|
||||||
"yazi-core",
|
"yazi-core",
|
||||||
@ -2870,7 +2870,7 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"uzers",
|
"uzers",
|
||||||
"yazi-adaptor",
|
"yazi-adapter",
|
||||||
"yazi-boot",
|
"yazi-boot",
|
||||||
"yazi-config",
|
"yazi-config",
|
||||||
"yazi-dds",
|
"yazi-dds",
|
||||||
|
@ -41,12 +41,12 @@ https://github.com/sxyazi/yazi/assets/17523360/92ff23fa-0cd5-4f04-b387-894c12265
|
|||||||
| Platform | Protocol | Support |
|
| Platform | Protocol | Support |
|
||||||
| ----------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
| ----------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
||||||
| kitty | [Kitty unicode placeholders](https://sw.kovidgoyal.net/kitty/graphics-protocol/#unicode-placeholders) | ✅ Built-in |
|
| kitty | [Kitty unicode placeholders](https://sw.kovidgoyal.net/kitty/graphics-protocol/#unicode-placeholders) | ✅ Built-in |
|
||||||
| Konsole | [Kitty old protocol](https://github.com/sxyazi/yazi/blob/main/yazi-adaptor/src/kitty_old.rs) | ✅ Built-in |
|
| Konsole | [Kitty old protocol](https://github.com/sxyazi/yazi/blob/main/yazi-adapter/src/kitty_old.rs) | ✅ 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 |
|
||||||
| WezTerm | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
| WezTerm | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
||||||
| Mintty (Git Bash) | [Inline images protocol](https://iterm2.com/documentation-images.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 |
|
| foot | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in |
|
||||||
| Ghostty | [Kitty old protocol](https://github.com/sxyazi/yazi/blob/main/yazi-adaptor/src/kitty_old.rs) | ✅ Built-in |
|
| Ghostty | [Kitty old protocol](https://github.com/sxyazi/yazi/blob/main/yazi-adapter/src/kitty_old.rs) | ✅ Built-in |
|
||||||
| Black Box | [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 |
|
||||||
| VSCode | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
| VSCode | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
||||||
| Tabby | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
| Tabby | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
cargo publish -p yazi-shared
|
cargo publish -p yazi-shared
|
||||||
cargo publish -p yazi-config
|
cargo publish -p yazi-config
|
||||||
cargo publish -p yazi-proxy
|
cargo publish -p yazi-proxy
|
||||||
cargo publish -p yazi-adaptor
|
cargo publish -p yazi-adapter
|
||||||
cargo publish -p yazi-boot
|
cargo publish -p yazi-boot
|
||||||
cargo publish -p yazi-dds
|
cargo publish -p yazi-dds
|
||||||
cargo publish -p yazi-scheduler
|
cargo publish -p yazi-scheduler
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "yazi-adaptor"
|
name = "yazi-adapter"
|
||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi image adaptor"
|
description = "Yazi image adapter"
|
||||||
homepage = "https://yazi-rs.github.io"
|
homepage = "https://yazi-rs.github.io"
|
||||||
repository = "https://github.com/sxyazi/yazi"
|
repository = "https://github.com/sxyazi/yazi"
|
||||||
|
|
@ -9,7 +9,7 @@ use super::{Iterm2, Kitty, KittyOld};
|
|||||||
use crate::{Chafa, Emulator, Sixel, Ueberzug, SHOWN, TMUX};
|
use crate::{Chafa, Emulator, Sixel, Ueberzug, SHOWN, TMUX};
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||||
pub enum Adaptor {
|
pub enum Adapter {
|
||||||
Kitty,
|
Kitty,
|
||||||
KittyOld,
|
KittyOld,
|
||||||
Iterm2,
|
Iterm2,
|
||||||
@ -21,7 +21,7 @@ pub enum Adaptor {
|
|||||||
Chafa,
|
Chafa,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Adaptor {
|
impl Display for Adapter {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Kitty => write!(f, "kitty"),
|
Self::Kitty => write!(f, "kitty"),
|
||||||
@ -35,7 +35,7 @@ impl Display for Adaptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Adaptor {
|
impl Adapter {
|
||||||
pub async fn image_show(self, path: &Path, max: Rect) -> Result<Rect> {
|
pub async fn image_show(self, path: &Path, max: Rect) -> Result<Rect> {
|
||||||
match self {
|
match self {
|
||||||
Self::Kitty => Kitty::image_show(path, max).await,
|
Self::Kitty => Kitty::image_show(path, max).await,
|
||||||
@ -76,7 +76,7 @@ impl Adaptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Adaptor {
|
impl Adapter {
|
||||||
pub fn matches() -> Self {
|
pub fn matches() -> Self {
|
||||||
let mut protocols = Emulator::detect().adapters();
|
let mut protocols = Emulator::detect().adapters();
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ impl Adaptor {
|
|||||||
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" => return Self::Wayland,
|
"wayland" => return Self::Wayland,
|
||||||
_ => warn!("[Adaptor] Could not identify XDG_SESSION_TYPE"),
|
_ => warn!("[Adapter] Could not identify XDG_SESSION_TYPE"),
|
||||||
}
|
}
|
||||||
if env_exists("WAYLAND_DISPLAY") {
|
if env_exists("WAYLAND_DISPLAY") {
|
||||||
return Self::Wayland;
|
return Self::Wayland;
|
||||||
@ -106,7 +106,7 @@ impl Adaptor {
|
|||||||
return Self::KittyOld;
|
return Self::KittyOld;
|
||||||
}
|
}
|
||||||
|
|
||||||
warn!("[Adaptor] Falling back to chafa");
|
warn!("[Adapter] Falling back to chafa");
|
||||||
Self::Chafa
|
Self::Chafa
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ use crossterm::{cursor::MoveTo, queue};
|
|||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use tokio::process::Command;
|
use tokio::process::Command;
|
||||||
|
|
||||||
use crate::{Adaptor, Emulator};
|
use crate::{Adapter, Emulator};
|
||||||
|
|
||||||
pub(super) struct Chafa;
|
pub(super) struct Chafa;
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ impl Chafa {
|
|||||||
height: lines.len() as u16,
|
height: lines.len() as u16,
|
||||||
};
|
};
|
||||||
|
|
||||||
Adaptor::Chafa.image_hide()?;
|
Adapter::Chafa.image_hide()?;
|
||||||
Adaptor::shown_store(area);
|
Adapter::shown_store(area);
|
||||||
Emulator::move_lock((max.x, max.y), |stderr| {
|
Emulator::move_lock((max.x, max.y), |stderr| {
|
||||||
for (i, line) in lines.into_iter().enumerate() {
|
for (i, line) in lines.into_iter().enumerate() {
|
||||||
stderr.write_all(line)?;
|
stderr.write_all(line)?;
|
@ -7,11 +7,11 @@ use tokio::{io::{AsyncReadExt, BufReader}, time::timeout};
|
|||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
use yazi_shared::env_exists;
|
use yazi_shared::env_exists;
|
||||||
|
|
||||||
use crate::{Adaptor, CLOSE, ESCAPE, START, TMUX};
|
use crate::{Adapter, CLOSE, ESCAPE, START, TMUX};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Emulator {
|
pub enum Emulator {
|
||||||
Unknown(Vec<Adaptor>),
|
Unknown(Vec<Adapter>),
|
||||||
Kitty,
|
Kitty,
|
||||||
Konsole,
|
Konsole,
|
||||||
Iterm2,
|
Iterm2,
|
||||||
@ -29,20 +29,20 @@ pub enum Emulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Emulator {
|
impl Emulator {
|
||||||
pub fn adapters(self) -> Vec<Adaptor> {
|
pub fn adapters(self) -> Vec<Adapter> {
|
||||||
match self {
|
match self {
|
||||||
Self::Unknown(adapters) => adapters,
|
Self::Unknown(adapters) => adapters,
|
||||||
Self::Kitty => vec![Adaptor::Kitty],
|
Self::Kitty => vec![Adapter::Kitty],
|
||||||
Self::Konsole => vec![Adaptor::KittyOld],
|
Self::Konsole => vec![Adapter::KittyOld],
|
||||||
Self::Iterm2 => vec![Adaptor::Iterm2, Adaptor::Sixel],
|
Self::Iterm2 => vec![Adapter::Iterm2, Adapter::Sixel],
|
||||||
Self::WezTerm => vec![Adaptor::Iterm2, Adaptor::Sixel],
|
Self::WezTerm => vec![Adapter::Iterm2, Adapter::Sixel],
|
||||||
Self::Foot => vec![Adaptor::Sixel],
|
Self::Foot => vec![Adapter::Sixel],
|
||||||
Self::Ghostty => vec![Adaptor::KittyOld],
|
Self::Ghostty => vec![Adapter::KittyOld],
|
||||||
Self::BlackBox => vec![Adaptor::Sixel],
|
Self::BlackBox => vec![Adapter::Sixel],
|
||||||
Self::VSCode => vec![Adaptor::Iterm2, Adaptor::Sixel],
|
Self::VSCode => vec![Adapter::Iterm2, Adapter::Sixel],
|
||||||
Self::Tabby => vec![Adaptor::Iterm2, Adaptor::Sixel],
|
Self::Tabby => vec![Adapter::Iterm2, Adapter::Sixel],
|
||||||
Self::Hyper => vec![Adaptor::Iterm2, Adaptor::Sixel],
|
Self::Hyper => vec![Adapter::Iterm2, Adapter::Sixel],
|
||||||
Self::Mintty => vec![Adaptor::Iterm2],
|
Self::Mintty => vec![Adapter::Iterm2],
|
||||||
Self::Neovim => vec![],
|
Self::Neovim => vec![],
|
||||||
Self::Apple => vec![],
|
Self::Apple => vec![],
|
||||||
Self::Urxvt => vec![],
|
Self::Urxvt => vec![],
|
||||||
@ -67,7 +67,7 @@ impl Emulator {
|
|||||||
];
|
];
|
||||||
match vars.into_iter().find(|v| env_exists(v.0)) {
|
match vars.into_iter().find(|v| env_exists(v.0)) {
|
||||||
Some(var) => return var.1,
|
Some(var) => return var.1,
|
||||||
None => warn!("[Adaptor] No special environment variables detected"),
|
None => warn!("[Adapter] No special environment variables detected"),
|
||||||
}
|
}
|
||||||
|
|
||||||
let (term, program) = Self::via_env();
|
let (term, program) = Self::via_env();
|
||||||
@ -81,7 +81,7 @@ impl Emulator {
|
|||||||
"Hyper" => return Self::Hyper,
|
"Hyper" => return Self::Hyper,
|
||||||
"mintty" => return Self::Mintty,
|
"mintty" => return Self::Mintty,
|
||||||
"Apple_Terminal" => return Self::Apple,
|
"Apple_Terminal" => return Self::Apple,
|
||||||
_ => warn!("[Adaptor] Unknown TERM_PROGRAM: {program}"),
|
_ => warn!("[Adapter] Unknown TERM_PROGRAM: {program}"),
|
||||||
}
|
}
|
||||||
match term.as_str() {
|
match term.as_str() {
|
||||||
"xterm-kitty" => return Self::Kitty,
|
"xterm-kitty" => return Self::Kitty,
|
||||||
@ -89,7 +89,7 @@ impl Emulator {
|
|||||||
"foot-extra" => return Self::Foot,
|
"foot-extra" => return Self::Foot,
|
||||||
"xterm-ghostty" => return Self::Ghostty,
|
"xterm-ghostty" => return Self::Ghostty,
|
||||||
"rxvt-unicode-256color" => return Self::Urxvt,
|
"rxvt-unicode-256color" => return Self::Urxvt,
|
||||||
_ => warn!("[Adaptor] Unknown TERM: {term}"),
|
_ => warn!("[Adapter] Unknown TERM: {term}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::via_csi().unwrap_or(Self::Unknown(vec![]))
|
Self::via_csi().unwrap_or(Self::Unknown(vec![]))
|
||||||
@ -148,10 +148,10 @@ impl Emulator {
|
|||||||
|
|
||||||
let mut adapters = Vec::with_capacity(2);
|
let mut adapters = Vec::with_capacity(2);
|
||||||
if resp.contains("\x1b_Gi=31;OK") {
|
if resp.contains("\x1b_Gi=31;OK") {
|
||||||
adapters.push(Adaptor::KittyOld);
|
adapters.push(Adapter::KittyOld);
|
||||||
}
|
}
|
||||||
if ["?4;", "?4c", ";4;", ";4c"].iter().any(|s| resp.contains(s)) {
|
if ["?4;", "?4c", ";4;", ";4c"].iter().any(|s| resp.contains(s)) {
|
||||||
adapters.push(Adaptor::Sixel);
|
adapters.push(Adapter::Sixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Self::Unknown(adapters))
|
Ok(Self::Unknown(adapters))
|
@ -7,7 +7,7 @@ use image::{codecs::jpeg::JpegEncoder, DynamicImage};
|
|||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
|
|
||||||
use super::image::Image;
|
use super::image::Image;
|
||||||
use crate::{adaptor::Adaptor, Emulator, CLOSE, START};
|
use crate::{adapter::Adapter, Emulator, CLOSE, START};
|
||||||
|
|
||||||
pub(super) struct Iterm2;
|
pub(super) struct Iterm2;
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ impl Iterm2 {
|
|||||||
let area = Image::pixel_area((img.width(), img.height()), max);
|
let area = Image::pixel_area((img.width(), img.height()), max);
|
||||||
let b = Self::encode(img).await?;
|
let b = Self::encode(img).await?;
|
||||||
|
|
||||||
Adaptor::Iterm2.image_hide()?;
|
Adapter::Iterm2.image_hide()?;
|
||||||
Adaptor::shown_store(area);
|
Adapter::shown_store(area);
|
||||||
Emulator::move_lock((max.x, max.y), |stderr| {
|
Emulator::move_lock((max.x, max.y), |stderr| {
|
||||||
stderr.write_all(&b)?;
|
stderr.write_all(&b)?;
|
||||||
Ok(area)
|
Ok(area)
|
@ -8,7 +8,7 @@ use image::DynamicImage;
|
|||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
|
|
||||||
use super::image::Image;
|
use super::image::Image;
|
||||||
use crate::{adaptor::Adaptor, Emulator, CLOSE, ESCAPE, START};
|
use crate::{adapter::Adapter, Emulator, CLOSE, ESCAPE, START};
|
||||||
|
|
||||||
static DIACRITICS: [char; 297] = [
|
static DIACRITICS: [char; 297] = [
|
||||||
'\u{0305}',
|
'\u{0305}',
|
||||||
@ -320,8 +320,8 @@ impl Kitty {
|
|||||||
let b1 = Self::encode(img).await?;
|
let b1 = Self::encode(img).await?;
|
||||||
let b2 = Self::place(&area)?;
|
let b2 = Self::place(&area)?;
|
||||||
|
|
||||||
Adaptor::Kitty.image_hide()?;
|
Adapter::Kitty.image_hide()?;
|
||||||
Adaptor::shown_store(area);
|
Adapter::shown_store(area);
|
||||||
Emulator::move_lock((area.x, area.y), |stderr| {
|
Emulator::move_lock((area.x, area.y), |stderr| {
|
||||||
stderr.write_all(&b1)?;
|
stderr.write_all(&b1)?;
|
||||||
stderr.write_all(&b2)?;
|
stderr.write_all(&b2)?;
|
@ -7,7 +7,7 @@ use image::DynamicImage;
|
|||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
|
|
||||||
use super::image::Image;
|
use super::image::Image;
|
||||||
use crate::{adaptor::Adaptor, Emulator, CLOSE, ESCAPE, START};
|
use crate::{adapter::Adapter, Emulator, CLOSE, ESCAPE, START};
|
||||||
|
|
||||||
pub(super) struct KittyOld;
|
pub(super) struct KittyOld;
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ impl KittyOld {
|
|||||||
let area = Image::pixel_area((img.width(), img.height()), max);
|
let area = Image::pixel_area((img.width(), img.height()), max);
|
||||||
let b = Self::encode(img).await?;
|
let b = Self::encode(img).await?;
|
||||||
|
|
||||||
Adaptor::KittyOld.image_hide()?;
|
Adapter::KittyOld.image_hide()?;
|
||||||
Adaptor::shown_store(area);
|
Adapter::shown_store(area);
|
||||||
Emulator::move_lock((area.x, area.y), |stderr| {
|
Emulator::move_lock((area.x, area.y), |stderr| {
|
||||||
stderr.write_all(&b)?;
|
stderr.write_all(&b)?;
|
||||||
Ok(area)
|
Ok(area)
|
@ -1,6 +1,6 @@
|
|||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
|
|
||||||
mod adaptor;
|
mod adapter;
|
||||||
mod chafa;
|
mod chafa;
|
||||||
mod dimension;
|
mod dimension;
|
||||||
mod emulator;
|
mod emulator;
|
||||||
@ -11,7 +11,7 @@ mod kitty_old;
|
|||||||
mod sixel;
|
mod sixel;
|
||||||
mod ueberzug;
|
mod ueberzug;
|
||||||
|
|
||||||
pub use adaptor::*;
|
pub use adapter::*;
|
||||||
use chafa::*;
|
use chafa::*;
|
||||||
pub use dimension::*;
|
pub use dimension::*;
|
||||||
pub use emulator::*;
|
pub use emulator::*;
|
||||||
@ -24,7 +24,7 @@ use yazi_shared::{env_exists, RoCell};
|
|||||||
|
|
||||||
pub use crate::image::*;
|
pub use crate::image::*;
|
||||||
|
|
||||||
pub static ADAPTOR: RoCell<Adaptor> = RoCell::new();
|
pub static ADAPTOR: RoCell<Adapter> = RoCell::new();
|
||||||
|
|
||||||
// Tmux support
|
// Tmux support
|
||||||
pub static TMUX: RoCell<bool> = RoCell::new();
|
pub static TMUX: RoCell<bool> = RoCell::new();
|
||||||
@ -52,6 +52,6 @@ pub fn init() {
|
|||||||
|
|
||||||
SHOWN.with(Default::default);
|
SHOWN.with(Default::default);
|
||||||
|
|
||||||
ADAPTOR.init(Adaptor::matches());
|
ADAPTOR.init(Adapter::matches());
|
||||||
ADAPTOR.start();
|
ADAPTOR.start();
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ use image::DynamicImage;
|
|||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use yazi_config::PREVIEW;
|
use yazi_config::PREVIEW;
|
||||||
|
|
||||||
use crate::{adaptor::Adaptor, Emulator, Image, CLOSE, ESCAPE, START};
|
use crate::{adapter::Adapter, Emulator, Image, CLOSE, ESCAPE, START};
|
||||||
|
|
||||||
pub(super) struct Sixel;
|
pub(super) struct Sixel;
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ impl Sixel {
|
|||||||
let area = Image::pixel_area((img.width(), img.height()), max);
|
let area = Image::pixel_area((img.width(), img.height()), max);
|
||||||
let b = Self::encode(img).await?;
|
let b = Self::encode(img).await?;
|
||||||
|
|
||||||
Adaptor::Sixel.image_hide()?;
|
Adapter::Sixel.image_hide()?;
|
||||||
Adaptor::shown_store(area);
|
Adapter::shown_store(area);
|
||||||
Emulator::move_lock((area.x, area.y), |stderr| {
|
Emulator::move_lock((area.x, area.y), |stderr| {
|
||||||
stderr.write_all(&b)?;
|
stderr.write_all(&b)?;
|
||||||
Ok(area)
|
Ok(area)
|
@ -8,7 +8,7 @@ use tracing::{debug, warn};
|
|||||||
use yazi_config::PREVIEW;
|
use yazi_config::PREVIEW;
|
||||||
use yazi_shared::RoCell;
|
use yazi_shared::RoCell;
|
||||||
|
|
||||||
use crate::{Adaptor, Image};
|
use crate::{Adapter, Image};
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
static DEMON: RoCell<Option<UnboundedSender<Option<(PathBuf, Rect)>>>> = RoCell::new();
|
static DEMON: RoCell<Option<UnboundedSender<Option<(PathBuf, Rect)>>>> = RoCell::new();
|
||||||
@ -16,12 +16,12 @@ static DEMON: RoCell<Option<UnboundedSender<Option<(PathBuf, Rect)>>>> = RoCell:
|
|||||||
pub(super) struct Ueberzug;
|
pub(super) struct Ueberzug;
|
||||||
|
|
||||||
impl Ueberzug {
|
impl Ueberzug {
|
||||||
pub(super) fn start(adaptor: Adaptor) {
|
pub(super) fn start(adapter: Adapter) {
|
||||||
if !adaptor.needs_ueberzug() {
|
if !adapter.needs_ueberzug() {
|
||||||
return DEMON.init(None);
|
return DEMON.init(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut child = Self::create_demon(adaptor).ok();
|
let mut child = Self::create_demon(adapter).ok();
|
||||||
let (tx, mut rx) = mpsc::unbounded_channel();
|
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
@ -31,7 +31,7 @@ impl Ueberzug {
|
|||||||
child = None;
|
child = None;
|
||||||
}
|
}
|
||||||
if child.is_none() {
|
if child.is_none() {
|
||||||
child = Self::create_demon(adaptor).ok();
|
child = Self::create_demon(adapter).ok();
|
||||||
}
|
}
|
||||||
if let Some(c) = &mut child {
|
if let Some(c) = &mut child {
|
||||||
Self::send_command(c, cmd).await.ok();
|
Self::send_command(c, cmd).await.ok();
|
||||||
@ -53,7 +53,7 @@ impl Ueberzug {
|
|||||||
let area = Image::pixel_area((w as u32, h as u32), max);
|
let area = Image::pixel_area((w as u32, h as u32), max);
|
||||||
tx.send(Some((path.to_owned(), area)))?;
|
tx.send(Some((path.to_owned(), area)))?;
|
||||||
|
|
||||||
Adaptor::shown_store(area);
|
Adapter::shown_store(area);
|
||||||
Ok(area)
|
Ok(area)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,10 +65,10 @@ impl Ueberzug {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_demon(adaptor: Adaptor) -> Result<Child> {
|
fn create_demon(adapter: Adapter) -> Result<Child> {
|
||||||
// TODO: demon
|
// TODO: demon
|
||||||
let result = Command::new("ueberzugpp")
|
let result = Command::new("ueberzugpp")
|
||||||
.args(["layer", "-so", &adaptor.to_string()])
|
.args(["layer", "-so", &adapter.to_string()])
|
||||||
.env("SPDLOG_LEVEL", if cfg!(debug_assertions) { "debug" } else { "" })
|
.env("SPDLOG_LEVEL", if cfg!(debug_assertions) { "debug" } else { "" })
|
||||||
.kill_on_drop(true)
|
.kill_on_drop(true)
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
@ -10,7 +10,7 @@ repository = "https://github.com/sxyazi/yazi"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
regex = "1.10.4"
|
regex = "1.10.4"
|
||||||
yazi-adaptor = { path = "../yazi-adaptor", version = "0.2.5" }
|
yazi-adapter = { path = "../yazi-adapter", version = "0.2.5" }
|
||||||
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
||||||
yazi-shared = { path = "../yazi-shared", version = "0.2.5" }
|
yazi-shared = { path = "../yazi-shared", version = "0.2.5" }
|
||||||
|
|
||||||
|
@ -76,12 +76,12 @@ impl Boot {
|
|||||||
writeln!(s, " Version: {}", Self::process_output("ya", "--version"))?;
|
writeln!(s, " Version: {}", Self::process_output("ya", "--version"))?;
|
||||||
|
|
||||||
writeln!(s, "\nEmulator")?;
|
writeln!(s, "\nEmulator")?;
|
||||||
writeln!(s, " Emulator.via_env: {:?}", yazi_adaptor::Emulator::via_env())?;
|
writeln!(s, " Emulator.via_env: {:?}", yazi_adapter::Emulator::via_env())?;
|
||||||
writeln!(s, " Emulator.via_csi: {:?}", yazi_adaptor::Emulator::via_csi())?;
|
writeln!(s, " Emulator.via_csi: {:?}", yazi_adapter::Emulator::via_csi())?;
|
||||||
writeln!(s, " Emulator.detect : {:?}", yazi_adaptor::Emulator::detect())?;
|
writeln!(s, " Emulator.detect : {:?}", yazi_adapter::Emulator::detect())?;
|
||||||
|
|
||||||
writeln!(s, "\nAdaptor")?;
|
writeln!(s, "\nAdapter")?;
|
||||||
writeln!(s, " Adaptor.matches: {:?}", yazi_adaptor::Adaptor::matches())?;
|
writeln!(s, " Adapter.matches: {:?}", yazi_adapter::Adapter::matches())?;
|
||||||
|
|
||||||
writeln!(s, "\nDesktop")?;
|
writeln!(s, "\nDesktop")?;
|
||||||
writeln!(s, " XDG_SESSION_TYPE: {:?}", env::var_os("XDG_SESSION_TYPE"))?;
|
writeln!(s, " XDG_SESSION_TYPE: {:?}", env::var_os("XDG_SESSION_TYPE"))?;
|
||||||
@ -114,7 +114,7 @@ impl Boot {
|
|||||||
writeln!(s, " block : {:?}", yazi_config::OPEN.block_opener("bulk.txt", "text/plain"))?;
|
writeln!(s, " block : {:?}", yazi_config::OPEN.block_opener("bulk.txt", "text/plain"))?;
|
||||||
|
|
||||||
writeln!(s, "\ntmux")?;
|
writeln!(s, "\ntmux")?;
|
||||||
writeln!(s, " TMUX : {:?}", *yazi_adaptor::TMUX)?;
|
writeln!(s, " TMUX : {:?}", *yazi_adapter::TMUX)?;
|
||||||
writeln!(s, " Version: {}", Self::process_output("tmux", "-V"))?;
|
writeln!(s, " Version: {}", Self::process_output("tmux", "-V"))?;
|
||||||
|
|
||||||
writeln!(s, "\nDependencies")?;
|
writeln!(s, "\nDependencies")?;
|
||||||
|
@ -9,7 +9,7 @@ homepage = "https://yazi-rs.github.io"
|
|||||||
repository = "https://github.com/sxyazi/yazi"
|
repository = "https://github.com/sxyazi/yazi"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
yazi-adaptor = { path = "../yazi-adaptor", version = "0.2.5" }
|
yazi-adapter = { path = "../yazi-adapter", version = "0.2.5" }
|
||||||
yazi-boot = { path = "../yazi-boot", version = "0.2.5" }
|
yazi-boot = { path = "../yazi-boot", version = "0.2.5" }
|
||||||
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
||||||
yazi-dds = { path = "../yazi-dds", version = "0.2.5" }
|
yazi-dds = { path = "../yazi-dds", version = "0.2.5" }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crossterm::event::KeyCode;
|
use crossterm::event::KeyCode;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use yazi_adaptor::Dimension;
|
use yazi_adapter::Dimension;
|
||||||
use yazi_config::{keymap::{Control, Key}, KEYMAP};
|
use yazi_config::{keymap::{Control, Key}, KEYMAP};
|
||||||
use yazi_shared::{render, render_and, Layer};
|
use yazi_shared::{render, render_and, Layer};
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use std::time::{Duration, SystemTime};
|
|||||||
use tokio::{pin, task::JoinHandle};
|
use tokio::{pin, task::JoinHandle};
|
||||||
use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt};
|
use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt};
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
use yazi_adaptor::ADAPTOR;
|
use yazi_adapter::ADAPTOR;
|
||||||
use yazi_config::PLUGIN;
|
use yazi_config::PLUGIN;
|
||||||
use yazi_plugin::{external::Highlighter, isolate, utils::PreviewLock};
|
use yazi_plugin::{external::Highlighter, isolate, utils::PreviewLock};
|
||||||
use yazi_shared::{fs::{Cha, File, FilesOp, Url}, MIME_DIR};
|
use yazi_shared::{fs::{Cha, File, FilesOp, Url}, MIME_DIR};
|
||||||
|
@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration};
|
|||||||
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use tokio::{task::JoinHandle, time::sleep};
|
use tokio::{task::JoinHandle, time::sleep};
|
||||||
use yazi_adaptor::Dimension;
|
use yazi_adapter::Dimension;
|
||||||
use yazi_scheduler::{Ongoing, Scheduler, TaskSummary};
|
use yazi_scheduler::{Ongoing, Scheduler, TaskSummary};
|
||||||
use yazi_shared::{emit, event::Cmd, Layer};
|
use yazi_shared::{emit, event::Cmd, Layer};
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ default = [ "vendored-lua" ]
|
|||||||
vendored-lua = [ "mlua/vendored" ]
|
vendored-lua = [ "mlua/vendored" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
yazi-adaptor = { path = "../yazi-adaptor", version = "0.2.5" }
|
yazi-adapter = { path = "../yazi-adapter", version = "0.2.5" }
|
||||||
yazi-boot = { path = "../yazi-boot", version = "0.2.5" }
|
yazi-boot = { path = "../yazi-boot", version = "0.2.5" }
|
||||||
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
||||||
yazi-core = { path = "../yazi-core", version = "0.2.5" }
|
yazi-core = { path = "../yazi-core", version = "0.2.5" }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crossterm::terminal::WindowSize;
|
use crossterm::terminal::WindowSize;
|
||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use yazi_adaptor::Dimension;
|
use yazi_adapter::Dimension;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::Cmd;
|
||||||
|
|
||||||
use crate::{app::App, notify};
|
use crate::{app::App, notify};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::path::MAIN_SEPARATOR;
|
use std::path::MAIN_SEPARATOR;
|
||||||
|
|
||||||
use ratatui::{buffer::Buffer, layout::Rect, widgets::{Block, BorderType, List, ListItem, Widget}};
|
use ratatui::{buffer::Buffer, layout::Rect, widgets::{Block, BorderType, List, ListItem, Widget}};
|
||||||
use yazi_adaptor::Dimension;
|
use yazi_adapter::Dimension;
|
||||||
use yazi_config::{popup::{Offset, Position}, THEME};
|
use yazi_config::{popup::{Offset, Position}, THEME};
|
||||||
|
|
||||||
use crate::Ctx;
|
use crate::Ctx;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use yazi_adaptor::Dimension;
|
use yazi_adapter::Dimension;
|
||||||
use yazi_config::popup::{Origin, Position};
|
use yazi_config::popup::{Origin, Position};
|
||||||
use yazi_core::{completion::Completion, help::Help, input::Input, manager::Manager, notify::Notify, select::Select, tasks::Tasks, which::Which};
|
use yazi_core::{completion::Completion, help::Help, input::Input, manager::Manager, notify::Notify, select::Select, tasks::Tasks, which::Which};
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
yazi_config::init()?;
|
yazi_config::init()?;
|
||||||
|
|
||||||
yazi_adaptor::init();
|
yazi_adapter::init();
|
||||||
|
|
||||||
yazi_boot::init();
|
yazi_boot::init();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use std::{io::{self, stderr, BufWriter, Stderr}, ops::{Deref, DerefMut}, sync::a
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use crossterm::{cursor::{RestorePosition, SavePosition}, event::{DisableBracketedPaste, EnableBracketedPaste, KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags}, execute, queue, style::Print, terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen, SetTitle}};
|
use crossterm::{cursor::{RestorePosition, SavePosition}, event::{DisableBracketedPaste, EnableBracketedPaste, KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags}, execute, queue, style::Print, terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen, SetTitle}};
|
||||||
use ratatui::{backend::CrosstermBackend, buffer::Buffer, layout::Rect, CompletedFrame, Frame, Terminal};
|
use ratatui::{backend::CrosstermBackend, buffer::Buffer, layout::Rect, CompletedFrame, Frame, Terminal};
|
||||||
use yazi_adaptor::Emulator;
|
use yazi_adapter::Emulator;
|
||||||
use yazi_config::INPUT;
|
use yazi_config::INPUT;
|
||||||
|
|
||||||
static CSI_U: AtomicBool = AtomicBool::new(false);
|
static CSI_U: AtomicBool = AtomicBool::new(false);
|
||||||
|
@ -13,7 +13,7 @@ default = [ "vendored-lua" ]
|
|||||||
vendored-lua = [ "mlua/vendored" ]
|
vendored-lua = [ "mlua/vendored" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
yazi-adaptor = { path = "../yazi-adaptor", version = "0.2.5" }
|
yazi-adapter = { path = "../yazi-adapter", version = "0.2.5" }
|
||||||
yazi-boot = { path = "../yazi-boot", version = "0.2.5" }
|
yazi-boot = { path = "../yazi-boot", version = "0.2.5" }
|
||||||
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
yazi-config = { path = "../yazi-config", version = "0.2.5" }
|
||||||
yazi-dds = { path = "../yazi-dds", version = "0.2.5" }
|
yazi-dds = { path = "../yazi-dds", version = "0.2.5" }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use mlua::{FromLua, UserData};
|
use mlua::{FromLua, UserData};
|
||||||
use yazi_adaptor::Dimension;
|
use yazi_adapter::Dimension;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, FromLua)]
|
#[derive(Debug, Clone, Copy, FromLua)]
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
|
@ -2,7 +2,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||||||
|
|
||||||
use mlua::{Lua, Table, UserData};
|
use mlua::{Lua, Table, UserData};
|
||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use yazi_adaptor::ADAPTOR;
|
use yazi_adapter::ADAPTOR;
|
||||||
|
|
||||||
use super::{RectRef, Renderable};
|
use super::{RectRef, Renderable};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use mlua::{IntoLuaMulti, Lua, Table, Value};
|
use mlua::{IntoLuaMulti, Lua, Table, Value};
|
||||||
use yazi_adaptor::{Image, ADAPTOR};
|
use yazi_adapter::{Image, ADAPTOR};
|
||||||
|
|
||||||
use super::Utils;
|
use super::Utils;
|
||||||
use crate::{bindings::Cast, elements::{Rect, RectRef}, url::UrlRef};
|
use crate::{bindings::Cast, elements::{Rect, RectRef}, url::UrlRef};
|
||||||
|
Loading…
Reference in New Issue
Block a user