summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-04-26 21:20:59 +0200
committercashmere <cashmere@autistici.org>2026-04-26 21:20:59 +0200
commit15970781b5e3eafaac2fd7ed3730079fd4cfb451 (patch)
tree05569f4f7bf9962413ec5363209ee9eef667082a
parentb4e12512a0db4ce8823e2265faf020bb222875a7 (diff)
downloadkitty-graphics-15970781b5e3eafaac2fd7ed3730079fd4cfb451.tar.gz
fix(justfile): test-sixel-tmux skips nesting when already inside tmux
Running `just test-sixel-tmux' from a tmux pane previously printed `sessions should be nested with care, unset $TMUX to force' and exited with code 1. Switch the recipe to a shebang body that branches at runtime: when `$TMUX' is already set, run emacs directly in the current pane (the test condition is already satisfied -- we're inside tmux); otherwise spawn a fresh `tmux new-session' wrapper as before.
-rw-r--r--justfile29
1 files changed, 21 insertions, 8 deletions
diff --git a/justfile b/justfile
index 008f4ad..306290e 100644
--- a/justfile
+++ b/justfile
@@ -145,15 +145,28 @@ test-sixel-image encoder="":
--eval "(kitty-graphics-mode 1)" \
tests/test-image.png
-# Open test-image.png inside `tmux new-session', sixel backend forced
-# (run on a sixel-capable outer terminal, requires tmux >= 3.4)
+# Open test-image.png inside tmux with sixel backend forced.
+# Outer terminal must be sixel-capable (foot, Konsole, mintty, mlterm, WezTerm).
+# Requires tmux >= 3.4 built with --enable-sixel.
+# When already inside tmux, runs emacs directly (no nesting).
test-sixel-tmux encoder="":
- @echo ">> Outer terminal must be sixel-capable (foot, Konsole, mintty, ...)."
- @echo ">> tmux >= 3.4 with --enable-sixel required."
- tmux new-session -As kgfx-sixel-test "TERM={{TERM_}} {{EMACS}} -nw -Q -l {{SRC}} \
- --eval '(setq kitty-gfx-debug t kitty-gfx-preferred-protocol (quote sixel))' \
- --eval '(when (> (length \"{{encoder}}\") 0) (setq kitty-gfx-sixel-encoder-program \"{{encoder}}\"))' \
- --eval '(kitty-graphics-mode 1)' tests/test-image.png"
+ #!/usr/bin/env bash
+ set -eu
+ if [ -n "${TMUX:-}" ]; then
+ echo ">> Already inside tmux -- running emacs directly in this pane."
+ exec env TERM={{TERM_}} {{EMACS}} -nw -Q -l {{SRC}} \
+ --eval '(setq kitty-gfx-debug t kitty-gfx-preferred-protocol (quote sixel))' \
+ --eval '(when (> (length "{{encoder}}") 0) (setq kitty-gfx-sixel-encoder-program "{{encoder}}"))' \
+ --eval '(kitty-graphics-mode 1)' \
+ tests/test-image.png
+ else
+ echo ">> Outer terminal must be sixel-capable; spawning fresh tmux session."
+ exec tmux new-session -As kgfx-sixel-test \
+ "TERM={{TERM_}} {{EMACS}} -nw -Q -l {{SRC}} \
+ --eval '(setq kitty-gfx-debug t kitty-gfx-preferred-protocol (quote sixel))' \
+ --eval '(when (> (length \"{{encoder}}\") 0) (setq kitty-gfx-sixel-encoder-program \"{{encoder}}\"))' \
+ --eval '(kitty-graphics-mode 1)' tests/test-image.png"
+ fi
# --- Logs -------------------------------------------------------------------