| 1 | #!/usr/bin/env bash |
| 2 | # Regenerate the Linux hicolor theme icons in packaging/linux/hicolor from the app icon |
| 3 | # (crates/app/assets/icon/kvt-teams-256.png when present, otherwise teams-fast-256.png; |
| 4 | # the same file the app writes when it installs itself, see AppIcon::default()). |
| 5 | # |
| 6 | # Needs ImageMagick (magick or convert). The outputs are committed, so packaging never |
| 7 | # needs it. |
| 8 | # |
| 9 | # packaging/linux/icons.sh |
| 10 | set -euo pipefail |
| 11 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 12 | SRC="$ROOT/crates/app/assets/icon/teams-fast-256.png" |
| 13 | if [[ -f "$ROOT/crates/app/assets/icon/kvt-teams-256.png" ]]; then |
| 14 | SRC="$ROOT/crates/app/assets/icon/kvt-teams-256.png" |
| 15 | fi |
| 16 | OUT="$ROOT/packaging/linux/hicolor" |
| 17 | NAME=rusty-teams |
| 18 | |
| 19 | if command -v magick >/dev/null; then IM=(magick); elif command -v convert >/dev/null; then IM=(convert); else |
| 20 | echo "error: ImageMagick not found (apt install imagemagick)" >&2 |
| 21 | exit 1 |
| 22 | fi |
| 23 | |
| 24 | rm -rf "$OUT" |
| 25 | for s in 16 24 32 48 64 128 256; do |
| 26 | mkdir -p "$OUT/${s}x${s}/apps" |
| 27 | # -strip drops timestamps and profiles, so a rerun on the same source is byte-identical. |
| 28 | "${IM[@]}" "$SRC" -filter Lanczos -resize "${s}x${s}" -strip "PNG32:$OUT/${s}x${s}/apps/$NAME.png" |
| 29 | done |
| 30 | echo "icons written to $OUT" |