Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Add foot #190

Merged
merged 4 commits into from Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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])
p00f marked this conversation as resolved.
Show resolved Hide resolved

[GH-190]: https://github.com/lunaryorn/mdcat/pull/190

## [0.23.2] – 2021-07-18

### Changed
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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.
Expand All @@ -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

Expand Down
19 changes: 19 additions & 0 deletions src/terminal.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand All @@ -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 {
Expand Down