diff --git a/CHANGELOG.md b/CHANGELOG.md index 8892f1f5..7149830a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ To publish a new release run `scripts/release` from the project directory. ## [Unreleased] +### Added +- Support for [foot](https://codeberg.org/dnkl/foot/) (see [GH-190]) + +[GH-190]: https://github.com/lunaryorn/mdcat/pull/190 + ## [0.23.2] – 2021-07-18 ### Changed diff --git a/README.md b/README.md index 30be6744..d5d8911d 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Then it | [iTerm2][] | ✓ | ✓ | ✓ | ✓ 2) | ✓ | | [kitty][] | ✓ | ✓ | ✓ | ✓ 2) | | | [WezTerm][] | ✓ | ✓ | ✓ | ✓ 2) | | +| [foot][] | ✓ | ✓ | ✓ | | | 1) VTE is Gnome’s terminal emulation library used by many popular terminal emulators on Linux, including Gnome Terminal, Xfce Terminal, Tilix, etc. 2) SVG images require `rsvg-convert` from librsvg. @@ -53,6 +54,7 @@ Not supported: [ConEmu]: https://conemu.github.io [iterm2]: https://www.iterm2.com [WezTerm]: https://wezfurlong.org/wezterm/ +[foot]: https://codeberg.org/dnkl/foot/ ## Usage diff --git a/src/terminal.rs b/src/terminal.rs index b3d54e06..f92d2507 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -86,6 +86,11 @@ fn is_wezterm() -> bool { || std::env::var("TERM").map_or(false, |value| value == "wezterm") } +/// Checks if the current terminal is foot. +fn is_foot() -> bool { + std::env::var("TERM").map_or(false, |value| value == "foot") +} + impl TerminalCapabilities { /// A terminal which supports nothing. pub fn none() -> TerminalCapabilities { @@ -172,6 +177,18 @@ impl TerminalCapabilities { } } + /// Terminal capabilities of foot + /// Foot is a fast, lightweight and minimalistic Wayland terminal emulator + pub fn foot() -> TerminalCapabilities { + TerminalCapabilities { + name: "foot".to_string(), + style: Some(StyleCapability::Ansi(AnsiStyle)), + links: Some(LinkCapability::Osc8(self::osc::Osc8Links)), + image: None, + marks: None, + } + } + /// Detect the capabilities of the current terminal. pub fn detect() -> TerminalCapabilities { if self::iterm2::is_iterm2() { @@ -182,6 +199,8 @@ impl TerminalCapabilities { Self::kitty() } else if is_wezterm() { Self::wezterm() + } else if is_foot() { + Self::foot() } else if get_vte_version().filter(|&v| v >= (50, 0)).is_some() { Self::vte50() } else {