src/render-xfwm4.sh 1.4 K raw
1
#!/bin/sh
2
# Render the xfwm4 window decorations from their recoloured SVG sources.
3
#
4
# Upstream renders these through Inkscape's shell mode against one big
5
# baseplate file; the per-button SVGs in xfwm4/assets are 1:1 with their PNGs,
6
# so rsvg-convert is enough and much faster. Nine frame pieces have no SVG at
7
# all -- src/recolor-xfwm4-png.py handles those separately.
8
#
9
# Run from the theme root:  sh src/render-xfwm4.sh
10
11
set -e
12
command -v rsvg-convert >/dev/null || {
13
    echo "rsvg-convert not found: doas apk add librsvg" >&2
14
    exit 1
15
}
16
[ -d xfwm4/assets ] || { echo "run me from the theme root" >&2; exit 1; }
17
18
render() {   # render <scale> <destination dir>
19
    scale=$1
20
    dest=$2
21
    mkdir -p "$dest"
22
    n=0
23
    for svg in xfwm4/assets/*.svg; do
24
        name=$(basename "$svg" .svg)
25
        # match the source's own dimensions so each piece keeps its geometry
26
        w=$(sed -n 's/.*[^-]width="\([0-9.]*\)".*/\1/p' "$svg" | head -1)
27
        h=$(sed -n 's/.*[^-]height="\([0-9.]*\)".*/\1/p' "$svg" | head -1)
28
        rsvg-convert -w "$(awk "BEGIN{printf \"%d\", $w * $scale + 0.5}")" \
29
                     -h "$(awk "BEGIN{printf \"%d\", $h * $scale + 0.5}")" \
30
                     "$svg" -o "$dest/$name.png"
31
        n=$((n + 1))
32
    done
33
    echo "  $dest: $n"
34
}
35
36
echo "rendering xfwm4 decorations"
37
render 1   xfwm4
38
render 1.5 xfwm4/Darkmatter-hdpi/xfwm4
39
render 2   xfwm4/Darkmatter-xhdpi/xfwm4
40
41
python3 src/recolor-xfwm4-png.py