From df23247b0781012cf7f958ef78188fa78265150a Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 13 May 2026 15:52:36 +0100 Subject: [PATCH] Minimize fzf prompt size while centering it --- agent-cmd.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/agent-cmd.sh b/agent-cmd.sh index fab0aab..71beddd 100755 --- a/agent-cmd.sh +++ b/agent-cmd.sh @@ -13,11 +13,21 @@ if [ ${#agents[@]} -eq 0 ]; then exit 1 fi +# Minimize fzf prompt size while centering it. +width=24 +height=$((${#agents[@]} + 6)) +hmargin=$((($(tput cols) - width) / 2)) +vpad=$((($(tput lines) - height) / 2)) +[ $hmargin -lt 0 ] && hmargin=0 +[ $vpad -lt 0 ] && vpad=0 +tput cup "$vpad" 0 + agent=$(printf '%s\n' "${agents[@]}" | fzf \ --prompt='agent> ' \ --reverse \ --border=rounded \ - --margin=25%,30% \ + --height="$height" \ + --margin="0,$hmargin" \ --padding=1) if [ -n "$agent" ]; then