BlueGit

ict rusty-teams

Files

rusty-teams / packaging / linux / icons.sh

icons.sh

icons.sh 1.2 KiB Download Raw
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
10set -euo pipefail
11ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
12SRC="$ROOT/crates/app/assets/icon/teams-fast-256.png"
13if [[ -f "$ROOT/crates/app/assets/icon/kvt-teams-256.png" ]]; then
14 SRC="$ROOT/crates/app/assets/icon/kvt-teams-256.png"
15fi
16OUT="$ROOT/packaging/linux/hicolor"
17NAME=rusty-teams
18
19if 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
22fi
23
24rm -rf "$OUT"
25for 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"
29done
30echo "icons written to $OUT"