add render script for reproducible screenshots
This commit is contained in:
parent
9edbfe41e4
commit
66a0eda948
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# note: this script is not portable; to be run in the monobiome scripts/
|
||||||
|
# directory (notice the `rm` invocations)
|
||||||
|
|
||||||
rm -rf app-config/*
|
rm -rf app-config/*
|
||||||
symconf -c templates/ generate -o app-config
|
symconf -c templates/ generate -o app-config
|
||||||
|
|
||||||
35
scripts/render.sh
Normal file
35
scripts/render.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# usage: render.sh width height [extra kitty args...]
|
||||||
|
# useful for reproducible screenshots of terminal/vim setups
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
w=${1:?width}; h=${2:?height}
|
||||||
|
out="kitty-$(date +%Y%m%d-%H%M%S).png"
|
||||||
|
shift 2 || true
|
||||||
|
|
||||||
|
# spawn a kitty window w/ a mark
|
||||||
|
title="kitty-$(date +%s%N)"
|
||||||
|
kitty --title "$title" "$@" &
|
||||||
|
|
||||||
|
# create a targeted rule for the marked window and resize
|
||||||
|
sleep 2
|
||||||
|
swaymsg "for_window [title=\"$title\"] mark --add $title, floating enable, resize set width ${w} px height ${h} px, move position center" >/dev/null
|
||||||
|
|
||||||
|
# get the spawned window geometry
|
||||||
|
sleep 2
|
||||||
|
geom=$(swaymsg -t get_tree | jq -r --arg t "$title" '.. | select(.name? == $t) | .rect | "\(.x),\(.y) \(.width)x\(.height)"')
|
||||||
|
wgeom=$(swaymsg -t get_tree | jq -r --arg t "$title" '.. | select(.name? == $t) | .window_rect | "\(.x),\(.y) \(.width)x\(.height)"')
|
||||||
|
|
||||||
|
read gx gy _ < <(awk -F'[ ,x]' '{print $1,$2}' <<<"$geom")
|
||||||
|
read wx wy ww wh < <(awk -F'[ ,x]' '{print $1,$2,$3,$4}' <<<"$wgeom")
|
||||||
|
inner_geom="$((gx+wx)),$((gy+wy)) ${ww}x${wh}"
|
||||||
|
|
||||||
|
echo title=$title
|
||||||
|
echo geom=$geom
|
||||||
|
echo out=$out
|
||||||
|
|
||||||
|
# take a screenshot
|
||||||
|
mkdir -p "$(dirname "$out")"
|
||||||
|
grim -g "$inner_geom" "$out"
|
||||||
|
echo "saved: $out"
|
||||||
|
|
||||||
18
scripts/screens.sh
Normal file
18
scripts/screens.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
render_script="$script_dir/render.sh"
|
||||||
|
|
||||||
|
biomes=(alpine badlands chaparral savanna grassland tundra)
|
||||||
|
modes=(light dark)
|
||||||
|
|
||||||
|
for biome in "${biomes[@]}"; do
|
||||||
|
for mode in "${modes[@]}"; do
|
||||||
|
symconf config -m "$mode" -s "default-$biome-monobiome"
|
||||||
|
sleep 5
|
||||||
|
"$render_script" 800 600 nvim \
|
||||||
|
+':highlight Cursor blend=100' \
|
||||||
|
+':set guicursor=n:block-Cursor' \
|
||||||
|
+':silent! setlocal nonumber nocursorline signcolumn=no foldcolumn=no' \
|
||||||
|
examples/runner.py
|
||||||
Loading…
x
Reference in New Issue
Block a user