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

Commit

Permalink
Add support for WezTerm
Browse files Browse the repository at this point in the history
Wez's Terminal Emulator - https://wezfurlong.org/wezterm/

Uses iTerm image protocol for rendering images
  • Loading branch information
MuhammedZakir committed Jun 29, 2021
1 parent c1e594d commit 4761409
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
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]

## [0.23.0] - 2021-06-29

### Added
- Support for WezTerm - https://wezfurlong.org/wezterm/

## [0.22.4] – 2021-04-15

### Changed
Expand Down
27 changes: 27 additions & 0 deletions src/terminal.rs
Expand Up @@ -80,6 +80,12 @@ fn get_vte_version() -> Option<(u8, u8)> {
})
}

/// Check if current type of the terminal matches given string
fn is_wezterm() -> bool {
std::env::var("TERM")
.map_or(false, |value| value == "wezterm")
}

impl TerminalCapabilities {
/// A terminal which supports nothing.
pub fn none() -> TerminalCapabilities {
Expand Down Expand Up @@ -149,6 +155,25 @@ impl TerminalCapabilities {
}
}

// Wez's Terminal Emulator
//
// WezTerm is a GPU-accelerated cross-platform
// terminal emulator and multiplexer written by @wez
// and implemented in Rust
//
// https://wezfurlong.org/wezterm/
//
/// Terminal capabilities of WezTerm
pub fn wezterm() -> TerminalCapabilities {
TerminalCapabilities {
name: "WezTerm".to_string(),
style: Some(StyleCapability::Ansi(AnsiStyle)),
links: Some(LinkCapability::Osc8(self::osc::Osc8Links)),
image: Some(ImageCapability::ITerm2(self::iterm2::ITerm2Images)),
marks: None,
}
}

/// Detect the capabilities of the current terminal.
pub fn detect() -> TerminalCapabilities {
if self::iterm2::is_iterm2() {
Expand All @@ -157,6 +182,8 @@ impl TerminalCapabilities {
Self::terminology()
} else if self::kitty::is_kitty() {
Self::kitty()
} else if is_wezterm() {
Self::wezterm()
} else if get_vte_version().filter(|&v| v >= (50, 0)).is_some() {
Self::vte50()
} else {
Expand Down

0 comments on commit 4761409

Please sign in to comment.