Skip to content

Commit

Permalink
Enable support for ghostty (animated emotes don't worth though)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xithrius committed Jan 4, 2025
1 parent af2553f commit 9a50566
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/emotes/graphics_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,19 @@ fn query_terminal(command: &[u8]) -> Result<String> {
/// Then check that it supports the graphics protocol using temporary files, by sending a graphics protocol request followed by a request for terminal attributes.
/// If we receive the terminal attributes without receiving the response for the graphics protocol, it does not support it.
pub fn support_graphics_protocol() -> Result<bool> {
Ok(env::var("TERM")? == "xterm-kitty"
&& query_terminal(
format!(
concat!(gp!("i=31,s=1,v=1,a=q,t=d,f=24;{}"), csi!("c")),
STANDARD.encode("AAAA"),
)
.as_bytes(),
)?
.contains("OK"))
let supported_terminals = ["xterm-kitty", "xterm-ghostty"];

Ok(
env::var("TERM").map_or(false, |term| supported_terminals.contains(&term.as_str()))
&& query_terminal(
format!(
concat!(gp!("i=31,s=1,v=1,a=q,t=d,f=24;{}"), csi!("c")),
STANDARD.encode("AAAA"),
)
.as_bytes(),
)?
.contains("OK"),
)
}

#[cfg(test)]
Expand Down

0 comments on commit 9a50566

Please sign in to comment.