Skip to main content

TerminalKind

Enum TerminalKind 

Source
#[non_exhaustive]
pub enum TerminalKind {
Show 26 variants Alacritty, AppleTerminal, Cmder, ConEmu, Foot, Ghostty, GnomeTerminal, Hyper, ITerm2, JetBrains, Kitty, Konsole, Mintty, Rio, Rxvt, Screen, St, Terminator, Tilix, Vte, VSCode, Warp, WezTerm, WindowsTerminal, Xterm, Unknown,
}
Expand description

A terminal application or emulation family inferred from available hints.

A variant does not always identify the application hosting the session. For example, Xterm can mean only that TERM names an xterm-compatible emulation. Inspect TerminalInfo::detected_via to distinguish a program marker from a terminfo fallback. See Detection logic for precedence and each variant for its markers. See Edge cases and likely mismatches before treating a result as the current application’s identity. Listed TERM families match the exact name or a suffix beginning with - or .. Program names and terminfo names are matched case-insensitively; presence markers must be nonempty.

Unknown means no supported hint matched; raw values remain in TerminalInfo. fmt::Display returns a user-facing name, not a capability guarantee. The enum is non-exhaustive, so matches need a fallback for other and future variants.

§Example

use detect_terminal::{TerminalKind, detect};

match detect().kind {
    TerminalKind::Ghostty => println!("Ghostty hint found"),
    TerminalKind::Unknown => println!("No recognized terminal hint"),
    other => println!("Other application or emulation: {other}"),
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Alacritty

Alacritty terminal emulator. https://alacritty.org

Markers: ALACRITTY_SOCKET, TERM=alacritty. If Alacritty falls back to TERM=xterm-256color and has no socket marker, this variant cannot be selected from those hints alone.

§

AppleTerminal

Terminal.app on macOS. https://support.apple.com/guide/terminal/welcome/mac

Markers: TERM_PROGRAM=Apple_Terminal.

§

Cmder

Cmder terminal emulator. https://cmder.app

Markers: CMDER_ROOT. An inherited CMDER_ROOT can outlive the Cmder window that originally set it.

§

ConEmu

ConEmu terminal emulator. https://conemu.github.io

Markers: ConEmuPID, ConEmuHWND.

§

Foot

foot terminal emulator. https://codeberg.org/dnkl/foot

Markers: TERM=foot. A build without foot terminfo can use TERM=xterm-256color and will not select this kind from TERM alone.

§

Ghostty

Ghostty terminal emulator. https://ghostty.org

Markers: TERM_PROGRAM=ghostty, TERM=xterm-ghostty, TERM=ghostty.

§

GnomeTerminal

GNOME Terminal. https://wiki.gnome.org/Apps/Terminal

Markers: GNOME_TERMINAL_SERVICE, GNOME_TERMINAL_SCREEN.

§

Hyper

Hyper terminal emulator. https://hyper.is

Markers: TERM_PROGRAM=Hyper.

§

ITerm2

iTerm2 terminal emulator. https://iterm2.com

Markers: TERM_PROGRAM=iTerm.app. TERM_PROGRAM_VERSION supplies optional version metadata.

§

JetBrains

JetBrains IDE terminal. https://www.jetbrains.com/help/idea/terminal-emulator.html

Markers: TERMINAL_EMULATOR containing jetbrains.

§

Kitty

Kitty terminal emulator. https://sw.kovidgoyal.net/kitty/

Markers: KITTY_WINDOW_ID, KITTY_PID, TERM=xterm-kitty.

§

Konsole

Konsole terminal emulator. https://konsole.kde.org

Markers: KONSOLE_VERSION.

§

Mintty

mintty terminal emulator. https://mintty.github.io

Markers: TERM_PROGRAM=mintty.

§

Rio

Rio terminal emulator. https://rioterm.com

Markers: TERM_PROGRAM=rio, TERM=rio.

§

Rxvt

rxvt-unicode terminal emulator. https://software.schmorp.de/pkg/rxvt-unicode.html

Markers: RXVT_SOCKET, RXVT_TERM, TERM=rxvt.

§

Screen

GNU Screen terminal emulation. https://www.gnu.org/software/screen/

Markers: TERM=screen (mux marker STY only affects multiplexer detection).

§

St

Simple terminal (st). https://st.suckless.org

Markers: TERM=st.

§

Terminator

Terminator terminal emulator. https://gnome-terminator.org

Markers: TERMINATOR_UUID.

§

Tilix

Tilix terminal emulator. https://gnunn1.github.io/tilix-web/

Markers: TILIX_ID. Tilix copies many parent variables. A retained higher-priority marker can mask TILIX_ID.

§

Vte

VTE-based terminal emulator. https://wiki.gnome.org/Apps/Terminal/VTE

Markers: VTE_VERSION. This names the VTE emulation family, not a particular application using VTE.

§

VSCode

Visual Studio Code terminal. https://code.visualstudio.com/docs/terminal/basics

Markers: TERM_PROGRAM=vscode.

§

Warp

Warp terminal emulator. https://www.warp.dev

Markers: TERM_PROGRAM=WarpTerminal.

§

WezTerm

WezTerm terminal emulator. https://wezfurlong.org/wezterm/

Markers: TERM_PROGRAM=WezTerm, WEZTERM_EXECUTABLE, WEZTERM_PANE.

§

WindowsTerminal

Windows Terminal. https://aka.ms/terminal

Markers: WT_SESSION, TERM_PROGRAM=Windows_Terminal or WindowsTerminal. WT_SESSION can be absent when Windows Terminal attaches as the default console host after the shell has started. The TERM_PROGRAM values are recognized when supplied, but Windows Terminal does not inject them in its normal connection path.

§

Xterm

xterm terminal emulator. https://invisible-island.net/xterm/

Markers: XTERM_VERSION, TERM=xterm. A TERM=xterm* match identifies an emulation family; Alacritty, foot, and other applications can use xterm-256color.

§

Unknown

Unknown or unsupported terminal.

Trait Implementations§

Source§

impl Clone for TerminalKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TerminalKind

Source§

impl Debug for TerminalKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TerminalKind

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TerminalKind

Source§

impl Hash for TerminalKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TerminalKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TerminalKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.