fix: use Verstak brand icon in desktop builds

This commit is contained in:
mirivlad 2026-07-15 19:17:13 +08:00
parent 6eeebd39ad
commit bf965e8bf3
10 changed files with 109 additions and 1 deletions

View File

@ -232,6 +232,7 @@ Each vault is connected separately. The local vault remains the primary copy of
* Node.js 20 or newer with npm; * Node.js 20 or newer with npm;
* Python 3; * Python 3;
* Git; * Git;
* ImageMagick (`magick`) to generate the branded tray and application icons;
* Wails v2 build dependencies; * Wails v2 build dependencies;
* WebKitGTK development packages on Linux. * WebKitGTK development packages on Linux.

View File

@ -232,6 +232,7 @@ sha256sum -c SHA256SUMS --ignore-missing
* Node.js 20 или новее и npm; * Node.js 20 или новее и npm;
* Python 3; * Python 3;
* Git; * Git;
* ImageMagick (`magick`) для генерации фирменных значков трея и приложения;
* зависимости для сборки Wails v2; * зависимости для сборки Wails v2;
* пакеты разработки WebKitGTK в Linux. * пакеты разработки WebKitGTK в Linux.

View File

@ -2,7 +2,13 @@
package tray package tray
import "testing" import (
"bytes"
"image"
"image/color"
_ "image/png"
"testing"
)
func TestDefaultIconUsesPlatformResource(t *testing.T) { func TestDefaultIconUsesPlatformResource(t *testing.T) {
icon := DefaultIcon() icon := DefaultIcon()
@ -15,4 +21,23 @@ func TestDefaultIconUsesPlatformResource(t *testing.T) {
if string(icon[:8]) != "\x89PNG\r\n\x1a\n" { if string(icon[:8]) != "\x89PNG\r\n\x1a\n" {
t.Fatal("DefaultIcon() is not PNG data on Linux") t.Fatal("DefaultIcon() is not PNG data on Linux")
} }
assertVerstakBrand(t, icon)
}
func assertVerstakBrand(t *testing.T, icon []byte) {
t.Helper()
image, _, err := image.Decode(bytes.NewReader(icon))
if err != nil {
t.Fatalf("decode tray icon: %v", err)
}
want := color.NRGBA{R: 0x1c, G: 0x2f, B: 0x4a, A: 0xff}
for y := image.Bounds().Min.Y; y < image.Bounds().Max.Y; y++ {
for x := image.Bounds().Min.X; x < image.Bounds().Max.X; x++ {
if color.NRGBAModel.Convert(image.At(x, y)) == want {
return
}
}
}
t.Fatal("tray icon does not contain the Verstak navy brand color")
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -0,0 +1,27 @@
## Highlights
- Replaced the generic Wails image in the Linux tray and Windows application
resources with the current Verstak workbench icon.
- The desktop build now generates its PNG and multi-resolution ICO resources
from the committed Verstak SVG before packaging, preventing a generic icon
from returning in a clean build.
- The Windows ICO contains 16, 20, 24, 32, 48, and 256 pixel variants; Linux
uses the matching transparent PNG tray image.
## Главное
- Стандартный знак Wails в Linux-трее и ресурсах Windows заменён на актуальный
фирменный значок Верстака.
- Перед упаковкой desktop-сборка создаёт PNG и многомасштабный ICO из SVG,
хранящегося в репозитории. Это не позволяет стандартному значку вернуться в
чистой сборке.
- Windows ICO содержит варианты 16, 20, 24, 32, 48 и 256 пикселей; Linux
использует соответствующий прозрачный PNG для трея.
## Packages / Пакеты
This prerelease provides a portable Windows archive, a Debian package, and an
AppImage for Linux.
В этот prerelease входят переносимый архив для Windows, Debian-пакет и AppImage
для Linux.

View File

@ -35,6 +35,8 @@ fi
cd "$ROOT" cd "$ROOT"
echo "=== verstak desktop Windows amd64 build ===" echo "=== verstak desktop Windows amd64 build ==="
"$ROOT/scripts/generate-brand-icons.sh"
if [[ ! -d "$ROOT/frontend/node_modules" ]]; then if [[ ! -d "$ROOT/frontend/node_modules" ]]; then
if [[ -f "$ROOT/frontend/package-lock.json" ]]; then if [[ -f "$ROOT/frontend/package-lock.json" ]]; then
(cd "$ROOT/frontend" && npm ci --no-audit --no-fund) (cd "$ROOT/frontend" && npm ci --no-audit --no-fund)

View File

@ -6,6 +6,8 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
echo "=== verstak-desktop build ===" echo "=== verstak-desktop build ==="
echo "" echo ""
"$ROOT/scripts/generate-brand-icons.sh"
# ── Dependency checks ── # ── Dependency checks ──
echo "[deps]" echo "[deps]"
if ! command -v go &>/dev/null; then if ! command -v go &>/dev/null; then

48
scripts/generate-brand-icons.sh Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
MAGICK="${MAGICK_BIN:-magick}"
SOURCE="$ROOT/packaging/linux/verstak.svg"
if ! command -v "$MAGICK" >/dev/null; then
echo "ImageMagick is required to generate Verstak application icons: $MAGICK not found" >&2
exit 1
fi
if [[ ! -f "$SOURCE" ]]; then
echo "Verstak SVG icon source is missing: $SOURCE" >&2
exit 1
fi
render_png() {
local size="$1"
local target="$2"
mkdir -p "$(dirname "$target")"
"$MAGICK" -background none "$SOURCE" -resize "${size}x${size}" "PNG32:$target"
}
render_ico() {
local target="$1"
shift
local temporary
temporary="$(mktemp -d)"
local images=()
for size in "$@"; do
local image="$temporary/${size}.png"
render_png "$size" "$image"
images+=("$image")
done
mkdir -p "$(dirname "$target")"
"$MAGICK" "${images[@]}" "$target"
rm -rf "$temporary"
}
render_png 256 "$ROOT/internal/shell/tray/verstak.png"
render_ico "$ROOT/internal/shell/tray/verstak.ico" 16 20 24 32 48 256
# Wails consumes this PNG while it prepares the Windows executable resources.
# Both files are generated build inputs and therefore deliberately ignored by Git.
render_png 1024 "$ROOT/build/appicon.png"
render_ico "$ROOT/build/windows/icon.ico" 16 32 48 64 128 256
echo "generated Verstak tray and application icons from $SOURCE"

View File

@ -53,6 +53,8 @@ grep -Fq 'LinkId=2124701' "$ROOT/README.md"
grep -Fq 'WebView2 Runtime' "$ROOT/README.md" grep -Fq 'WebView2 Runtime' "$ROOT/README.md"
grep -Fq 'package-deb.sh' "$ROOT/scripts/release.sh" grep -Fq 'package-deb.sh' "$ROOT/scripts/release.sh"
grep -Fq 'package-appimage.sh' "$ROOT/scripts/release.sh" grep -Fq 'package-appimage.sh' "$ROOT/scripts/release.sh"
grep -Fq 'generate-brand-icons.sh' "$ROOT/scripts/build.sh"
grep -Fq 'generate-brand-icons.sh' "$ROOT/scripts/build-windows.sh"
grep -Fq 'package-windows-portable.sh' "$ROOT/scripts/release.sh" grep -Fq 'package-windows-portable.sh' "$ROOT/scripts/release.sh"
git -C "$ROOT" check-ignore -q verstak-desktop-res.syso git -C "$ROOT" check-ignore -q verstak-desktop-res.syso
grep -Fq 'chmod -R a+rX' "$ROOT/scripts/build-linux-bundle.sh" grep -Fq 'chmod -R a+rX' "$ROOT/scripts/build-linux-bundle.sh"