generate_theme_preview.sh 705 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. # This script generate all preview images for the themes
  3. # In order to capture previews without the to bar start kitty without decorations
  4. # kitty -o hide_window_decorations=yes
  5. # shellcheck source=libcapture.sh
  6. source libcapture.sh
  7. # read theme path from args
  8. id=$1
  9. theme=$2
  10. preview_filename=$3
  11. conf_filename=$(basename "$theme")
  12. lockfile=$(mktemp)
  13. kitty @ set-colors --match id:"$id" "$theme"
  14. kitty @ send-text --match id:"$id" "clear && figlet -f digital -t \"$conf_filename\" && unbuffer ./color_table.sh && rm \"$lockf\""
  15. # simple sync mechanism, wait for the lockfile to be removed
  16. ( echo "$lockfile" | entr "false" 1>/dev/null 2>&1 ) || capture themes "$preview_filename"