summaryrefslogtreecommitdiff
path: root/.config/kitty/kitty-themes/.tools/generate_theme_preview.sh
diff options
context:
space:
mode:
authorIndrajith K L2023-09-08 14:43:41 +0530
committerIndrajith K L2023-09-08 14:43:41 +0530
commit0f144c1ef9d831b1c663ef998f40e22c33156d9e (patch)
treedd20b22ce18b5e6e0b00b43d1b5a2699792563f1 /.config/kitty/kitty-themes/.tools/generate_theme_preview.sh
downloadDotFiles-master.tar.gz
DotFiles-master.tar.bz2
DotFiles-master.zip
Initial CommitHEADmaster
* Adds Basic dot files configs
Diffstat (limited to '.config/kitty/kitty-themes/.tools/generate_theme_preview.sh')
-rwxr-xr-x.config/kitty/kitty-themes/.tools/generate_theme_preview.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/.config/kitty/kitty-themes/.tools/generate_theme_preview.sh b/.config/kitty/kitty-themes/.tools/generate_theme_preview.sh
new file mode 100755
index 0000000..040867b
--- /dev/null
+++ b/.config/kitty/kitty-themes/.tools/generate_theme_preview.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# This script generate all preview images for the themes
+# In order to capture previews without the to bar start kitty without decorations
+# kitty -o hide_window_decorations=yes
+
+# shellcheck source=libcapture.sh
+source libcapture.sh
+
+# read theme path from args
+id=$1
+theme=$2
+preview_filename=$3
+
+conf_filename=$(basename "$theme")
+
+lockfile=$(mktemp)
+
+kitty @ set-colors --match id:"$id" "$theme"
+kitty @ send-text --match id:"$id" "clear && figlet -f digital -t \"$conf_filename\" && unbuffer ./color_table.sh && rm \"$lockfile\"\n"
+
+# simple sync mechanism, wait for the lockfile to be removed
+( echo "$lockfile" | entr "false" 1>/dev/null 2>&1 ) || capture themes "$preview_filename"