mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
Set TERM_PROGRAM and TERM_PROGRAM_VERSION environment variables.
WezTerm claims this is an emerging de-facto standard for terminal emulator identification:a103b6d97a/config/src/config.rs (L1526-L1529)
One example of usage in the wild is neovim doing capability detection:f050aaabbb/src/nvim/tui/tui.c (L206-L211)
Ghostty now reports this: $echo $TERM_PROGRAM ghostty $echo $TERM_PROGRAM_VERSION 0.1.0-main+aa08f3c I think it's really nice that the commit hash is included, as users can provide this in issue reports. WezTerm does the same. I use these variables in my tui library in addition to $TERM and $COLORTERM for capability detection, which is what motivated this PR.
This commit is contained in:
@ -612,6 +612,9 @@ const Subprocess = struct {
|
||||
try env.put("COLORTERM", "truecolor");
|
||||
}
|
||||
|
||||
try env.put("TERM_PROGRAM", "ghostty");
|
||||
try env.put("TERM_PROGRAM_VERSION", build_config.version_string);
|
||||
|
||||
// When embedding in macOS and running via XCode, XCode injects
|
||||
// a bunch of things that break our shell process. We remove those.
|
||||
if (comptime builtin.target.isDarwin() and build_config.artifact == .lib) {
|
||||
|
Reference in New Issue
Block a user