From 8567c89e8030e4b286725e7334b903ddca43ba6b Mon Sep 17 00:00:00 2001 From: NagyVikt Date: Sat, 16 May 2026 01:14:52 +0200 Subject: [PATCH] style(help-popup): glass treatment + sync pane menu shortcuts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refit scripts/codex-fleet/bin/help-popup.sh onto the same fg-only iOS glass chrome as pane-context-menu.sh so the help popup matches its sibling surface visually: - Replace `_ios_sgr` (which emits both fg AND bg) with a local `menu_fg` helper that emits truecolor foreground only. Background stays at the terminal default so tmux popup `-B` lets the underlying pane show through. - Use the agreed iOS palette: hairlines / corners #3A3A3C, section headers #007AFF bold (blue), key chips #FFCC00 bold (yellow), labels #FFFFFF, gray dot separator #8E8E93 between key + label, bottom hint #8E8E93. - Sync the listed pane-menu shortcuts to current state: add `p` Paste from clipboard (PR #140), reword to match pane-context-menu.sh labels ("Copy whole session", "Swap with marked pane", …). - Add a new "Nav (inside the pane menu)" section describing the arrow-nav focus model being added in the sister lane: ↑/↓ moves focus, ⏎ selects, esc cancels. - Header now renders as `⌨ codex-fleet · keyboard help [ HELP ]` to mirror the pane menu's `● pane · [ LIVE ]` shape. - Bottom hint updated to `any key closes · esc/q exits`. - Fix latent bug: top-level `local_pad=...` (outside any function) removed by moving header rendering into `draw_header()`. - Smoke-test stanza added in the header comment: `bash scripts/codex-fleet/bin/help-popup.sh < /dev/null`. Verification: - bash -n scripts/codex-fleet/bin/help-popup.sh -> 0 - docker koalaman/shellcheck:stable -> 0 - grep -nE 'Paste from clipboard|↑ / ↓|⏎' -> 6 matches - Smoke: bash help-popup.sh < /dev/null -> 0 (no solid-bg SGR in output: `grep -c '\[48;2;' = 0`). Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/codex-fleet/bin/help-popup.sh | 173 +++++++++++++++++--------- 1 file changed, 116 insertions(+), 57 deletions(-) diff --git a/scripts/codex-fleet/bin/help-popup.sh b/scripts/codex-fleet/bin/help-popup.sh index 844c750..ca59a81 100755 --- a/scripts/codex-fleet/bin/help-popup.sh +++ b/scripts/codex-fleet/bin/help-popup.sh @@ -6,13 +6,17 @@ # Two entry points, one screen, so the operator never has to remember # which surface owns the binding. # -# The popup is read-only: any keystroke (incl. esc/q) closes it. No -# dispatch — pressing `n` here does NOT spawn a worker; for that, dismiss -# this and open the matching menu/overlay. +# Transparency model: this script mirrors pane-context-menu.sh and emits +# foreground-only ANSI (`38;2;R;G;B`). When tmux popup is launched with +# `-B` (no border), the underlying pane shows through. Do NOT use solid +# background SGR (`48;2;...`) anywhere in this file. # # Glyph convention: Linux-friendly. Spotlight is `Ctrl K` (was ⌘K in the # fleet-tui-poc displays before this PR), context-menu hotkeys are bare # single letters, tmux bindings use the user's `prefix` (default Ctrl+B). +# +# Smoke test (standalone, exits when stdin EOFs): +# bash scripts/codex-fleet/bin/help-popup.sh < /dev/null set -eo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -22,43 +26,97 @@ source "$SCRIPT_DIR/../lib/ios-menu.sh" CARD_W=72 INNER_W=$(( CARD_W - 2 )) +IOS_SEPARATOR="#3A3A3C" + +# ── fg-only SGR helper (mirrors pane-context-menu.sh::menu_fg) ──────────── +# Emits truecolor foreground only. Background stays at the terminal default +# so tmux popup -B lets the pane show through (glass / transparent look). +menu_fg() { + local fg="$1"; shift || true + local hexfg="${fg#\#}" + local r g b out="" + + r=$((16#${hexfg:0:2})); g=$((16#${hexfg:2:2})); b=$((16#${hexfg:4:2})) + out+="\033[38;2;${r};${g};${b}m" + while [[ $# -gt 0 ]]; do + case "$1" in + bold) out+="\033[1m" ;; + dim) out+="\033[2m" ;; + italic) out+="\033[3m" ;; + underline) out+="\033[4m" ;; + esac + shift + done + printf '%b' "$out" +} -# ── chrome helpers (mirror pane-context-menu.sh so the visual lineage is -# identical and a future refactor can hoist these into ios-menu.sh) ── +menu_repeat() { + local char="$1" count="$2" i + for (( i=0; i' 'Scroll to bottom' +draw_row 'h' 'Horizontal split' +draw_row 'v' 'Vertical split' +draw_row 'z' 'Zoom pane' +draw_row 'u / d' 'Swap up / Swap down' +draw_row 's' 'Swap with marked pane' +draw_row 'm' 'Mark / Unmark pane' +draw_row 'R' 'Respawn pane' +draw_row 'X' 'Kill pane' +draw_row '?' 'This help' draw_hairline -draw_section 'Pane right-click menu' -draw_row 'C' 'Copy whole session scrollback to clipboard' -draw_row 'c' 'Copy visible viewport to clipboard' -draw_row 'l' 'Copy the line under the cursor' -draw_row '<' 'Scroll the pane to the top of its history' -draw_row '>' 'Scroll the pane to the bottom of its history' -draw_row 'h / v' 'Split the pane horizontally / vertically' -draw_row 'z' 'Zoom or unzoom the active pane' -draw_row 'u / d' 'Swap with the pane above / below' -draw_row 's' 'Swap with the tmux-marked pane (mark first with m)' -draw_row 'm' 'Mark / unmark this pane' -draw_row 'R' 'Respawn the pane (kills, then restarts)' -draw_row 'X' 'Kill the pane' -draw_row '? / Ctrl+H' 'Open this help screen' +draw_section 'Nav (inside the pane menu)' +draw_row '↑ / ↓' 'Move focus in pane menu' +draw_row '⏎' 'Select focused item' +draw_row 'esc' 'Cancel popup' draw_hairline -draw_section 'tmux bindings (after the prefix, default Ctrl+B)' -draw_row 'prefix m' 'Open the iOS Action Sheet (tear-down / swap / retarget)' -draw_row 'prefix Tab' 'Open the Section Jump grid (Overview / Fleet / Plan / Waves / Review)' +draw_section 'tmux bindings (after prefix, default Ctrl+B)' +draw_row 'prefix m' 'iOS Action Sheet (tear-down / swap / retarget)' +draw_row 'prefix Tab' 'Section Jump grid (Overview / Fleet / Plan / …)' draw_row 'prefix Ctrl+H' 'Open this help screen' draw_hairline draw_section 'Spotlight palette (inside fleet-tui-poc)' draw_row 'Ctrl+K' 'Open the Spotlight command palette' -draw_row 'Ctrl+N' 'Spawn a new codex worker (Linux equivalent of macOS ⌘N)' -draw_row 'Ctrl+B' 'Switch worktree (Linux equivalent of macOS ⌘B)' +draw_row 'Ctrl+N' 'Spawn a new codex worker (Linux ⌘N)' +draw_row 'Ctrl+B' 'Switch worktree (Linux ⌘B)' draw_row '↑ / ↓' 'Move the selection cursor' -draw_row '↵' 'Activate the highlighted item' +draw_row '⏎' 'Activate the highlighted item' draw_row 'esc' 'Dismiss the palette' draw_hairline draw_section 'Section Jump grid' -draw_row '1 – 5' 'Jump to Overview, Fleet, Plan, Waves, or Review' -draw_row '↵' 'Open the highlighted section in the current pane' +draw_row '1 – 5' 'Overview, Fleet, Plan, Waves, Review' +draw_row '⏎' 'Open the highlighted section in this pane' draw_row 'esc' 'Dismiss the grid' draw_bottom -_ios_sgr "$IOS_GRAY" "$IOS_BG"; printf '\n any key to close' +menu_fg "$IOS_GRAY"; printf '\n any key closes · esc/q exits' _ios_reset # Read one char then exit. The popup harness closes when this script returns. +# When stdin is /dev/null (smoke test) read returns immediately so the popup +# renders and exits cleanly without hanging. read -rsn1 -t 60 _ || : clear