#!/bin/bash

fzf_args=(
  --multi
  --preview 'echo "alt-p: toggle preview, alt-j/k: scroll, F11: maxime"; echo; yay -Sii {1}'
  --preview-window 'down:65%:wrap'
  --bind 'alt-p:toggle-preview'
  --bind 'alt-d:preview-half-page-down,alt-u:preview-half-page-up'
  --bind 'alt-k:preview-up,alt-j:preview-down'
)

pkg_name=$(yay -Slq | fzf "${fzf_args[@]}")

if [[ -n "$pkg_name" ]]; then
  yay -Sy --noconfirm "$pkg_name"
  sudo updatedb
  ~/.local/share/omarchy/bin/omarchy-show-done
fi
