Skip to content

Commit 790519b

Browse files
committed
Add auto-detection for ghostty to support Kitty protocol.
Fixes #121
1 parent 2c725d9 commit 790519b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: src/term-query.cc

+10-1
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,14 @@ TermGraphicsInfo QuerySupportedGraphicsProtocol() {
191191
result.known_broken_sixel_cursor_placement = false;
192192
result.in_tmux = false;
193193

194+
// Environment variables can be changed, so guesses from environment
195+
// variables are just that: guesses.
196+
// They will help as a fallback if the [>q query does not work.
197+
// Only testing environment variables with very specific content.
198+
194199
const char *const term = getenv("TERM");
195-
if (term && strcmp(term, "xterm-kitty") == 0) {
200+
if (term && ((strcmp(term, "xterm-kitty") == 0) ||
201+
(strcmp(term, "xterm-ghostty") == 0))) {
196202
result.preferred_graphics = GraphicsProtocol::kKitty;
197203
// Fall through, as we still have to determine if we're in tmux
198204
}
@@ -235,6 +241,9 @@ TermGraphicsInfo QuerySupportedGraphicsProtocol() {
235241
if (contains(data, len, "kitty")) {
236242
result.preferred_graphics = GraphicsProtocol::kKitty;
237243
}
244+
if (contains(data, len, "ghostty")) {
245+
result.preferred_graphics = GraphicsProtocol::kKitty;
246+
}
238247
if (contains(data, len, "mlterm")) {
239248
result.preferred_graphics = GraphicsProtocol::kSixel;
240249
}

0 commit comments

Comments
 (0)