Skip to content

Commit 5e651f6

Browse files
authored
feat: use kitty image protocol in ghostty (#405)
This detects ghostty and uses the kitty graphics protocol on it by default. I don't have access to ghostty yet so I can't test this but based on [this article](https://fredrikaverpil.github.io/blog/2024/12/04/ghostty-on-macos/) `TERM_PROGRAM=ghostty` is the way to detect this. If it implements the protocol correctly, this should work out of the box. @fredrikaverpil could I ask for your help here? :)
2 parents 1809efb + 37d71a9 commit 5e651f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/media/emulator.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub enum TerminalEmulator {
1515
Mlterm,
1616
St,
1717
Xterm,
18+
Ghostty,
1819
Unknown,
1920
}
2021

@@ -60,13 +61,14 @@ impl TerminalEmulator {
6061
TerminalEmulator::Mlterm => term == "mlterm",
6162
TerminalEmulator::St => term == "st-256color",
6263
TerminalEmulator::Xterm => ["xterm", "xterm-256color"].contains(&term),
64+
TerminalEmulator::Ghostty => term_program.contains("ghostty"),
6365
TerminalEmulator::Unknown => true,
6466
}
6567
}
6668

6769
fn supports_graphics_mode(&self, mode: &GraphicsMode, capabilities: &TerminalCapabilities) -> bool {
6870
match (mode, self) {
69-
(GraphicsMode::Kitty { mode, .. }, Self::Kitty | Self::WezTerm) => match mode {
71+
(GraphicsMode::Kitty { mode, .. }, Self::Kitty | Self::WezTerm | Self::Ghostty) => match mode {
7072
KittyMode::Local => capabilities.kitty_local,
7173
KittyMode::Remote => true,
7274
},

0 commit comments

Comments
 (0)