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

Use either TERM or TERM_PROGRAM to detect wezterm #186

Merged
merged 4 commits into from
Jul 18, 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]

### Changed
- WezTerm is now detected by `TERM` and `TERM_PROGRAM` environment variables (see [GH-186]).

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

## [0.23.1] – 2021-07-14

### Changed
Expand Down
3 changes: 2 additions & 1 deletion mdcat.1.adoc
Expand Up @@ -102,7 +102,8 @@ If run as `mdless` or if `--paginate` is given and the pager fails to start mdca
== Environment

TERM::
If this variable is `xterm-kitty`, assume that the terminal is Kitty.
If this variable is `wezterm`, mdcat assumes that the terminal is WezTerm. By default WezTerm does not set TERM to wezterm but mdcat can still detect it trough TERM_PROGRAM.
If this variable is `xterm-kitty`, mdcat assumes that the terminal is Kitty.

TERM_PROGRAM::
If this variable is `iTerm.app`, mdcat assumes that the terminal is iTerm2.
Expand Down
1 change: 1 addition & 0 deletions src/terminal.rs
Expand Up @@ -83,6 +83,7 @@ fn get_vte_version() -> Option<(u8, u8)> {
/// Checks if the current terminal is WezTerm.
fn is_wezterm() -> bool {
std::env::var("TERM_PROGRAM").map_or(false, |value| value == "WezTerm")
|| std::env::var("TERM").map_or(false, |value| value == "wezterm")
}

impl TerminalCapabilities {
Expand Down