From bf50fabdd9f5eda905b0173f10f7ac5a2f1c2287 Mon Sep 17 00:00:00 2001 From: Aaron Bull Schaefer Date: Fri, 18 Sep 2026 10:52:52 -0700 Subject: [PATCH 1/2] Accept cwd= from zmx list output zmx v0.8.0 replaced start_dir with cwd, tracking the session's live working directory via OSC7 rather than the directory it was created in. The list parser only stripped the start_dir prefix, so the path column rendered as "cwd=/path" and repo session counts never matched. Strip cwd first, falling back to start_dir so older zmx versions still work. Update the test and demo fakes to emit cwd, matching 0.8.1 output. --- demo/bin/zmx | 8 ++++---- tests/bin/zmx | 12 ++++++------ zp | 12 +++++++++--- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/demo/bin/zmx b/demo/bin/zmx index 048230d..fb89e33 100755 --- a/demo/bin/zmx +++ b/demo/bin/zmx @@ -14,12 +14,12 @@ list) 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" + printf ' name=whatchord.1\tpid=52341\tclients=0\tcreated=1\tcwd=%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" + printf '\342\206\222 name=%s\tpid=53347\tclients=1\tcreated=4\tcwd=%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" + printf ' name=zmx-picker.1\tpid=52502\tclients=0\tcreated=2\tcwd=%s/src/zmx-picker\n' "$HOME" + printf ' name=scratch\tpid=53113\tclients=0\tcreated=3\tcwd=%s\n' "$HOME" fi ;; history) diff --git a/tests/bin/zmx b/tests/bin/zmx index 23c402d..9b4146f 100755 --- a/tests/bin/zmx +++ b/tests/bin/zmx @@ -17,15 +17,15 @@ sessions() { if [ -e "$ZP_TEST_DIR/no-sessions" ]; then return 0 fi - printf '\342\206\222 name=alpha.1\tpid=11\tclients=1\tcreated=1\tstart_dir=/tmp\n' - printf ' name=alpha.2\tpid=12\tclients=0\tcreated=2\tstart_dir=/tmp\n' + printf '\342\206\222 name=alpha.1\tpid=11\tclients=1\tcreated=1\tcwd=/tmp\n' + printf ' name=alpha.2\tpid=12\tclients=0\tcreated=2\tcwd=/tmp\n' # beta carries labels (trailing tab-separated key=value fields) # and lives in a repo, so it also guards against those fields - # leaking into start_dir and breaking the repo-association count. - printf ' name=beta\tpid=13\tclients=0\tcreated=3\tstart_dir=%s\tproject=zp\tenv=work\n' \ + # leaking into cwd and breaking the repo-association count. + printf ' name=beta\tpid=13\tclients=0\tcreated=3\tcwd=%s\tproject=zp\tenv=work\n' \ "$ZP_TEST_DIR/root/plain" - printf ' name=d.gamma\tpid=14\tclients=0\tcreated=4\tstart_dir=/tmp\n' - printf ' name=d.omega.9\tpid=15\tclients=0\tcreated=5\tstart_dir=/tmp\n' + printf ' name=d.gamma\tpid=14\tclients=0\tcreated=4\tcwd=/tmp\n' + printf ' name=d.omega.9\tpid=15\tclients=0\tcreated=5\tcwd=/tmp\n' } alive() { diff --git a/zp b/zp index 63dbefc..9313ba0 100755 --- a/zp +++ b/zp @@ -71,11 +71,17 @@ candidates() { while IFS=$'\t' read -r name _ clients _ dir labels; do name=${name#*name=} clients=${clients#*clients=} + # zmx >= 0.8.0 reports the live working directory as cwd= + # (tracked via OSC 7); older versions reported the directory + # the session was created in as start_dir=. Accept either so + # the path column and repo session counts keep working. + dir=${dir#*cwd=} dir=${dir#*start_dir=} # Any session labels arrive as extra tab-separated key=value - # fields after start_dir; slurping them into their own field - # keeps a stray tab out of $dir, which would corrupt the path - # and the start_dir match behind repo session counts. Join + # fields after the directory; slurping them into their own + # field keeps a stray tab out of $dir, which would corrupt + # the path and the cwd match behind repo session counts. Join + # them with spaces for display; absent labels leave it empty. # them with spaces for display; absent labels leave it empty. labels=${labels//$'\t'/ } From 300d5ca753253c0ec4288af596840808400b5d10 Mon Sep 17 00:00:00 2001 From: Aaron Bull Schaefer Date: Fri, 18 Sep 2026 11:00:03 -0700 Subject: [PATCH 2/2] Release v0.4.0 --- zp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zp b/zp index 9313ba0..64a71cd 100755 --- a/zp +++ b/zp @@ -6,7 +6,7 @@ # shellcheck disable=SC2016 # literal $VARs in single quotes are deliberate set -euo pipefail -version=0.3.0 +version=0.4.0 # Absolute path to this script, for fzf reload bindings. self=$(cd "$(dirname "$0")" && pwd)/${0##*/}