Skip to content

Commit

Permalink
Add detection of Ghostty
Browse files Browse the repository at this point in the history
Close #57
  • Loading branch information
lusingander committed Jan 1, 2025
1 parent c096093 commit 465af3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ The terminals on which each has been confirmed to work are listed below.
| Terminal emulator | Support | Note |
| -------------------------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [iTerm2](https://iterm2.com) || But slower than other terminals |
| [WezTerm](https://wezfurlong.org/wezterm/index.html) || |
| [WezTerm](https://wezfurlong.org/wezterm/) || |
| [VSCode integrated terminal](https://code.visualstudio.com/docs/terminal/basics) || Requires the [`terminal.integrated.enableImages` setting](https://code.visualstudio.com/docs/terminal/advanced#_image-support) to be enabled |
| [Hyper](https://hyper.is) || >=[v4.0.0](https://github.com/vercel/hyper/releases/tag/v4.0.0-canary.4), not yet officially released |
| [Tabby](https://tabby.sh) || The graph background is not transparent |
Expand All @@ -324,6 +324,7 @@ The terminals on which each has been confirmed to work are listed below.
| Terminal emulator | Support | Note |
| ----------------------------------------- | ------- | ---- |
| [kitty](https://sw.kovidgoyal.net/kitty/) || |
| [Ghostty](https://ghostty.org) || |

### Unsupported environments

Expand Down
9 changes: 6 additions & 3 deletions src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ use base64::Engine;
pub fn auto_detect() -> ImageProtocol {
// https://sw.kovidgoyal.net/kitty/glossary/#envvar-KITTY_WINDOW_ID
if env::var("KITTY_WINDOW_ID").is_ok() {
ImageProtocol::Kitty
} else {
ImageProtocol::Iterm2
return ImageProtocol::Kitty;
}
// https://ghostty.org/docs/help/terminfo
if env::var("TERM").is_ok_and(|t| t == "xterm-ghostty") {
return ImageProtocol::Kitty;
}
ImageProtocol::Iterm2
}

#[derive(Debug, Clone, Copy)]
Expand Down

0 comments on commit 465af3e

Please sign in to comment.