Skip to content

Commit

Permalink
Enable support for ghostty (animated emotes don't work though)
Browse files Browse the repository at this point in the history
Don't know why only static emotes work at the moment, maybe just a bug
with ghostty. Animated emotes just show up as the first frame it seems.
  • Loading branch information
Xithrius committed Jan 4, 2025
1 parent af2553f commit 87d47ad
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 87d47ad

Please sign in to comment.