Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-detect Ghostty and Konsole as supporting the Kitty protocol #24

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Options:

A protocol type for rendering images of commit graphs.
By default `auto` will guess the best supported protocol for the current terminal.
Kitty terminals are detected as `kitty` via an environment variable, and all others are assumed to support `iterm`.
Kitty, Ghostty, and Konsole terminals are detected as `kitty` via environment variables, and all others are assumed to support `iterm`.

Refer to [Compatibility](#compatibility) for details.

Expand Down Expand Up @@ -249,6 +249,8 @@ 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://github.com/ghostty-org) | ○ | |
| [Konsole](https://konsole.kde.org/) | ○ | |

### Reporting Compatibility

Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ fn initialize_panic_handler() {
// By default assume the Iterm2 is the best protocol to use for all terminals *unless* an env
// variable is set that suggests the terminal is probably Kitty.
fn auto_detect_best_protocol() -> protocol::ImageProtocol {
if env::var("KITTY_WINDOW_ID").is_ok() {
if env::var("KITTY_WINDOW_ID").is_ok()
|| env::var("TERM_PROGRAM").is_ok_and(|t| t == "ghostty")
|| env::var("KONSOLE_VERSION").is_ok()
{
protocol::ImageProtocol::Kitty
} else {
protocol::ImageProtocol::Iterm2
Expand Down