A fork of the Materia GTK theme.

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 render-asset.sh

View raw Download
text/x-shellscript • 1.39 kiB
Bourne-Again shell script, ASCII text executable
        
            
1
#!/bin/bash
2
set -ueo pipefail
3
4
RENDER_SVG="$(command -v rendersvg)" || true
5
INKSCAPE="$(command -v inkscape)" || true
6
OPTIPNG="$(command -v optipng)" || true
7
8
if [[ "$1" == "dark" ]]; then
9
SRC_FILE="assets-dark.svg"
10
ASSETS_DIR="assets-dark"
11
else
12
SRC_FILE="assets.svg"
13
ASSETS_DIR="assets"
14
fi
15
16
i="$2"
17
18
# @TODO: remove $ZOOM when it will be fixed/implemented in resvg
19
GTK2_HIDPI="$(echo "${GTK2_HIDPI-False}" | tr '[:upper:]' '[:lower:]')"
20
if [[ "${GTK2_HIDPI}" == "true" ]]; then
21
DPI=192
22
ZOOM=2
23
else
24
DPI=96
25
ZOOM=1
26
fi
27
28
echo "Rendering '$ASSETS_DIR/$i.png'"
29
if [[ -n "${RENDER_SVG}" ]]; then
30
# @TODO: remove --zoom when it will be fixed/implemented in resvg
31
"$RENDER_SVG" --export-id "$i" \
32
--dpi ${DPI} \
33
--zoom ${ZOOM} \
34
"$SRC_FILE" "$ASSETS_DIR/$i.png"
35
else
36
if "$INKSCAPE" --help | grep -e "--export-filename" > /dev/null; then
37
EXPORT_FILE_OPTION="--export-filename"
38
elif "$INKSCAPE" --help | grep -e "--export-file" > /dev/null; then
39
EXPORT_FILE_OPTION="--export-file"
40
elif "$INKSCAPE" --help | grep -e "--export-png" > /dev/null; then
41
EXPORT_FILE_OPTION="--export-png"
42
fi
43
44
"$INKSCAPE" --export-id="$i" \
45
--export-id-only \
46
--export-dpi=${DPI} \
47
"$EXPORT_FILE_OPTION"="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
48
fi
49
50
if [[ -n "${OPTIPNG}" ]]; then
51
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
52
fi
53