diff --git a/icons/icon.html b/icons/icon.html index e890749..631cff4 100644 --- a/icons/icon.html +++ b/icons/icon.html @@ -1,5 +1,6 @@ icon - - + + + diff --git a/tools/shots.sh b/tools/shots.sh index fa00d77..6ac2d7d 100644 --- a/tools/shots.sh +++ b/tools/shots.sh @@ -22,14 +22,15 @@ until curl -fs -o /dev/null --max-time 2 "http://127.0.0.1:$PORT/"; do n=$((n + 1)); [ "$n" -lt 40 ] || { echo "the local server on port $PORT never answered" >&2; exit 1; }; sleep 0.5 done -# shoot : one headless screenshot, waited for +# shoot : one headless screenshot, waited for. The icon page draws its own box at the top left, +# so the crop is exact whatever viewport the runner's Chromium decides on. shoot() { prof=$(mktemp -d) rm -f "$3" # shellcheck disable=SC2086 "$CHROME" --headless=new --hide-scrollbars --no-first-run --no-default-browser-check --disable-background-networking \ - --disable-component-update --user-data-dir="$prof" --virtual-time-budget=6000 --window-size="$2" \ - --screenshot="$3" ${CHROME_FLAGS:-} "$1" >"$prof.log" 2>&1 & + --disable-component-update --force-device-scale-factor=1 --user-data-dir="$prof" --virtual-time-budget=6000 \ + --window-size="$2" --screenshot="$3" ${CHROME_FLAGS:-} "$1" >"$prof.log" 2>&1 & pid=$! n=0 while kill -0 "$pid" 2>/dev/null && [ ! -s "$3" ]; do n=$((n + 1)); [ "$n" -lt 120 ] || break; sleep 0.5; done @@ -42,6 +43,6 @@ shoot() { mkdir -p shots icons shoot "http://127.0.0.1:$PORT/" 1440,900 "$PWD/shots/desktop.png" -shoot "http://127.0.0.1:$PORT/icons/icon.html" 512,512 "$PWD/icons/icon-512.png" -shoot "http://127.0.0.1:$PORT/icons/icon.html" 192,192 "$PWD/icons/icon-192.png" -shoot "http://127.0.0.1:$PORT/icons/icon.html" 180,180 "$PWD/icons/apple-touch-icon.png" +shoot "http://127.0.0.1:$PORT/icons/icon.html?s=512" 512,512 "$PWD/icons/icon-512.png" +shoot "http://127.0.0.1:$PORT/icons/icon.html?s=192" 192,192 "$PWD/icons/icon-192.png" +shoot "http://127.0.0.1:$PORT/icons/icon.html?s=180" 180,180 "$PWD/icons/apple-touch-icon.png"