diff options
| author | cashmere <cashmere@autistici.org> | 2026-04-26 20:41:21 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-04-26 23:01:59 +0200 |
| commit | 72ce9ea06b64551f3a99147695c29631022ded8f (patch) | |
| tree | 3443b1be0bd13ace18db6c57286a7df4fa81a65d /kitty-graphics.el | |
| parent | 504635cee14ce19be1dd3a2d8d57c6b5a20fe44f (diff) | |
| download | kitty-graphics-72ce9ea06b64551f3a99147695c29631022ded8f.tar.gz | |
fix(sixel): detect Windows Terminal and route GIFs through image pipeline
Windows Terminal does not expose a stable `TERM' value, so the previous
sixel-detect check missed it. Accept the `WT_SESSION', `WT_PROFILE_ID'
and `WT_WINDOWID' environment markers it injects into every session.
Also add `gif' to `kitty-gfx--image-file-p' so GIF files are routed
through the image pipeline. Animation is still not supported -- only
the first frame is rendered -- but that is better than dropping them
on the floor.
AGENTS.md: list Windows Terminal under supported sixel terminals and
soften the GIF wording from "not supported" to "first frame only".
Closes #6.
Co-authored-by: Tim Felgentreff <timfel@users.noreply.github.com>
Diffstat (limited to 'kitty-graphics.el')
| -rw-r--r-- | kitty-graphics.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/kitty-graphics.el b/kitty-graphics.el index adfe6b7..430818a 100644 --- a/kitty-graphics.el +++ b/kitty-graphics.el @@ -642,17 +642,24 @@ Sixel because they drop the DCS payload." (in-tmux (getenv "TMUX")) (tmux-ver (and in-tmux (kitty-gfx--tmux-version))) (tmux-ok (kitty-gfx--tmux-sixel-supported-p)) + ;; Windows Terminal's TERM value is not stable enough to rely on + ;; alone, so accept its session markers when present. + (windows-terminal (or (getenv "WT_SESSION") + (getenv "WT_PROFILE_ID") + (getenv "WT_WINDOWID"))) (supported (and term (or (not in-tmux) tmux-ok) (or (string-match-p "xterm\\|vt[0-9]\\|foot\\|contour" term) (member term-prog '("foot" "Konsole" "mintty" "mlterm" - "contour" "WezTerm"))) + "contour" "WezTerm")) + windows-terminal) t))) (kitty-gfx--log - "sixel-detect: %s (TERM=%s TERM_PROGRAM=%s TMUX=%s tmux-ver=%s tmux-ok=%s)" + "sixel-detect: %s (TERM=%s TERM_PROGRAM=%s TMUX=%s tmux-ver=%s tmux-ok=%s WT=%s)" supported term term-prog (if in-tmux "yes" "no") (if tmux-ver (format "%d.%d" (car tmux-ver) (cadr tmux-ver)) "n/a") - (if tmux-ok "yes" "no")) + (if tmux-ok "yes" "no") + (if windows-terminal "yes" "no")) supported)) (defun kitty-gfx--sixel-cache-path (file cols rows) @@ -2289,11 +2296,13 @@ then let the refresh cycle re-emit the visible ones." (kitty-gfx--schedule-refresh))) (defun kitty-gfx--image-file-p (file) - "Return non-nil if FILE has an image extension." + "Return non-nil if FILE has an image extension. +GIF files are detected so they get routed through the image pipeline, +but only the first frame is rendered (no animation in terminal)." (let ((ext (file-name-extension file))) (and ext (member (downcase ext) '("png" "jpg" "jpeg" "bmp" "svg" - "webp" "tiff" "tif"))))) + "webp" "tiff" "tif" "gif"))))) (defun kitty-gfx--org-display-inline-images-tty (&optional _include-linked beg end) "Display inline images in org buffer via Kitty graphics. |
