From 9cd415ee47bff60f15de8df7568057047eda97d4 Mon Sep 17 00:00:00 2001 From: Aaron Bull Schaefer Date: Sat, 18 Jul 2026 10:04:30 -0700 Subject: [PATCH] End the demo inside the picker showing the current session Rendering could inherit a real ZMX_SESSION through vhs, falsely arrow-marking a staged session, so the demo env now drops it. The fake zmx lists ZMX_SESSION as an attached session after the tape's repo selection creates whatchord.2, and the tape reopens zp from inside it to close on the arrow marker and "you are here" preview. --- README.md | 2 +- demo/bin/zmx | 12 +++++++++++- demo/demo.tape | 9 +++++++++ demo/env.sh | 3 +++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e4f76e2..59a5f6b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ scrollback previews. When given root directories to search, it also lists any git or jj repositories beneath them. Selecting a session attaches to it; selecting a repository starts a numbered session inside it. -Animated demo of the zp session picker +Animated demo of the zp session picker [zmx]: https://github.com/neurosnap/zmx [fzf]: https://github.com/junegunn/fzf diff --git a/demo/bin/zmx b/demo/bin/zmx index 6d374ad..048230d 100755 --- a/demo/bin/zmx +++ b/demo/bin/zmx @@ -4,10 +4,20 @@ case $1 in list) + # After the tape's attach, $ZMX_SESSION names a session (e.g. + # whatchord.2) that the canned data doesn't know; list it as the + # attached one so the reopened picker shows a current session. if [ "${2:-}" = "--short" ]; then - printf 'whatchord.1\nzmx-picker.1\nscratch\n' + printf 'whatchord.1\n' + if [ -n "${ZMX_SESSION:-}" ]; then + printf '%s\n' "$ZMX_SESSION" + fi + printf 'zmx-picker.1\nscratch\n' else printf ' name=whatchord.1\tpid=52341\tclients=0\tcreated=1\tstart_dir=%s/src/whatchord\n' "$HOME" + if [ -n "${ZMX_SESSION:-}" ]; then + printf '\342\206\222 name=%s\tpid=53347\tclients=1\tcreated=4\tstart_dir=%s/src/whatchord\n' "$ZMX_SESSION" "$HOME" + fi printf ' name=zmx-picker.1\tpid=52502\tclients=0\tcreated=2\tstart_dir=%s/src/zmx-picker\n' "$HOME" printf ' name=scratch\tpid=53113\tclients=0\tcreated=3\tstart_dir=%s\n' "$HOME" fi diff --git a/demo/demo.tape b/demo/demo.tape index 9188df2..168d53e 100644 --- a/demo/demo.tape +++ b/demo/demo.tape @@ -46,3 +46,12 @@ Type "jj st" Sleep 500ms Enter Sleep 3s + +# Reopen the picker from inside the session: whatchord.2 carries +# the arrow marker and a "you are here" preview. +Type "zp" +Sleep 500ms +Enter +Sleep 2.5s +Down +Sleep 4s diff --git a/demo/env.sh b/demo/env.sh index 7134f23..cdcc01d 100644 --- a/demo/env.sh +++ b/demo/env.sh @@ -5,5 +5,8 @@ sh demo/setup.sh export ZP_ROOT=/tmp/zp-demo/src export PATH="$PWD:$PWD/demo/bin:$PATH" export HOME=/tmp/zp-demo +# The render may itself run inside a real zmx session; the demo +# starts outside any, so drop the inherited session environment. +unset ZMX_SESSION ZMX_SESSION_PREFIX export PS1='\n\w \[\e[38;2;250;179;135m\]❯\[\e[0m\] ' cd "$HOME" || return