feat: Adds previews to utils-launcher, sources catppuccin colors file in zshrc so that fzf options are setup.

This commit is contained in:
2025-10-05 11:05:05 -04:00
parent 5e8fbbcbab
commit 4edf92e034
3 changed files with 22 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ window_padding_x="2"
config_file=""
launch_flag="0"
rows=()
XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
SCRIPTS=${SCRIPTS}
@@ -61,6 +62,15 @@ footer() {
EOF
}
generate_rows() {
readarray -t names <<<"$(echo "$1" | jq -r '.[] | .name')"
readarray -t execs <<<"$(echo "$1" | jq -r '.[] | .exec')"
for i in "${!names[@]}"; do
rows+=("${execs[i]}|${names[i]}")
done
}
################################################################################
# MAIN
################################################################################
@@ -89,7 +99,16 @@ file_data=$(cat $config_file)
# Setup colors before calling fzf.
[[ -f $SCRIPTS/catppuccin-colors ]] && source $SCRIPTS/catppuccin-colors
sel=$(echo "$file_data" | jq -r '.[] | .name' | fzf --style=full --footer="$(footer)")
generate_rows "$file_data"
# sel=$(echo "$file_data" | jq -r '.[] | .name' | fzf --style=full --footer="$(footer)")
echo "ROWS: ${rows[@]}"
sel=$(
printf "%s\n" "${rows[@]}" |
fzf --style=full --footer="$(footer)" --with-nth=2 --delimiter='|' \
--preview-label='[ Command ]' \
--preview='printf "\nName: {2}\nExec: {1}"'
)
echo "Selection: $sel"