-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use single rendering script for all variations
- uses single render-assets.sh for all variations - single rendering script takes care of all assets used in gtk variations and xfwm variations - reduces repo size and better automation - No need to include .png files with repo as they can be generated during building deb packaging - better rendering of assets for new themes like gtk-4.0 - original rendering scripts has been kept back but can be removed
- Loading branch information
Showing
2 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#! /bin/bash | ||
|
||
INKSCAPE="/usr/bin/inkscape" | ||
OPTIPNG="/usr/bin/optipng" | ||
|
||
INDEX="assets.txt" | ||
if [[ $1 != "-dark" ]]; then | ||
SRC_FILE="assets.svg" | ||
ASSETS_DIR="assets" | ||
else | ||
SRC_FILE="assets"$1".svg" | ||
ASSETS_DIR="assets"$1 | ||
fi | ||
mkdir -p $ASSETS_DIR | ||
|
||
render() | ||
{ | ||
echo Rendering $1 | ||
if [[ "$1" == *"@2"* ]]; then | ||
$INKSCAPE --export-id=$2 --export-dpi=192 \ | ||
"${INKSCAPE_OPTS[@]}" $1 $SRC_FILE >/dev/null 2>&1 \ | ||
&& $OPTIPNG -o7 --quiet $1 | ||
else | ||
$INKSCAPE --export-id=$2 "${INKSCAPE_OPTS[@]}" $1 $SRC_FILE >/dev/null 2>&1 \ | ||
&& $OPTIPNG -o7 --quiet $1 | ||
fi | ||
} | ||
|
||
# Set options for Inkscape depending on version. | ||
INKSCAPE_OPTS=( --export-id-only ) | ||
case $($INKSCAPE -V | cut -d' ' -f2) in | ||
# NB: The export option (-e or -o) must be the last option in the INKSCAPE_OPTS array. | ||
0.*) INKSCAPE_OPTS+=('-z' '-e');; # -z specifies not to launch GUI, -e is export | ||
1.*) INKSCAPE_OPTS+=('-o');; # v1.0+ uses no GUI by default, -e replaced by -o | ||
esac | ||
|
||
for i in `cat $INDEX` | ||
do | ||
if [ -f $ASSETS_DIR/$i.png ]; then | ||
echo $ASSETS_DIR/$i.png exists. | ||
else | ||
render $ASSETS_DIR/$i.png $i & | ||
# allow only to execute number of jobs in parallel | ||
# equal to number of processors | ||
if [[ $(jobs -r -p | wc -l) -gt $(nproc) ]]; then | ||
# wait only for first job | ||
wait $(jobs -p) | ||
fi | ||
fi | ||
if [[ $1 == "s2" ]]; then | ||
if [ -f $ASSETS_DIR/$i@2.png ]; then | ||
echo $ASSETS_DIR/$i@2.png exists. | ||
else | ||
render $ASSETS_DIR/$i@2.png $i & | ||
# allow only to execute number of jobs in parallel | ||
# equal to number of processors | ||
if [[ $(jobs -r -p | wc -l) -gt $(nproc) ]]; then | ||
# wait only for first job | ||
wait $(jobs -p) | ||
fi | ||
fi | ||
fi | ||
done | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters