Files
YanDisk/scripts/generate_icons.sh
T
akhmed 9098340f2a YanDisk v1.0.1: тёмная иконка по теме системы, вкладки (Скриншоты скрыт, Файлы→Доступные мне), синк по умолчанию 'В облаке', ПРАВКИ.md
- Иконка: AppIconDark.icns + переключение Dock-иконки по effectiveAppearance (KVO)
- Сайдбар: убран 'Скриншоты', 'Файлы' → 'Доступные мне' (заглушка), первая вкладка — все файлы и папки
- SyncPolicyStore.globalMode по умолчанию .cloudOnly ('В облаке')
- build.sh/smoke_test.sh: SDKROOT из Xcode (фикс SDK-конфликта тулчейна 6.3.3/SDK 6.4)
- ПРАВКИ.md: полный аудит и план доработок
2026-09-15 21:16:22 +03:00

68 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# Генерация macOS AppIcon.icns + Assets.xcassets (light/dark) из icons/*.png
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
"$MIMO_PYTHON" - <<PY
from PIL import Image
from pathlib import Path
import subprocess, shutil, json
root = Path("$ROOT")
icons = root / "icons"
res = root / "Resources"
res.mkdir(exist_ok=True)
light_src = Image.open(icons / "Icon-iOS-Default-1024x1024@1x.png").convert("RGBA")
dark_src = Image.open(icons / "Icon-iOS-Dark-1024x1024@1x.png").convert("RGBA")
sizes = [16, 32, 128, 256, 512]
def write_iconset(src, out_dir: Path):
if out_dir.exists():
shutil.rmtree(out_dir)
out_dir.mkdir(parents=True)
for s in sizes:
for scale in (1, 2):
px = s * scale
img = src.resize((px, px), Image.Resampling.LANCZOS)
name = f"icon_{s}x{s}{'@2x' if scale==2 else ''}.png"
img.save(out_dir / name)
light_iconset = res / "AppIcon.iconset"
write_iconset(light_src, light_iconset)
icns = res / "AppIcon.icns"
subprocess.check_call(["iconutil", "-c", "icns", str(light_iconset), "-o", str(icns)])
shutil.rmtree(light_iconset)
dark_iconset = res / "AppIconDark.iconset"
write_iconset(dark_src, dark_iconset)
dark_icns = res / "AppIconDark.icns"
subprocess.check_call(["iconutil", "-c", "icns", str(dark_iconset), "-o", str(dark_icns)])
shutil.rmtree(dark_iconset)
catalog = res / "Assets.xcassets"
appicon = catalog / "AppIcon.appiconset"
if catalog.exists():
shutil.rmtree(catalog)
appicon.mkdir(parents=True)
(catalog / "Contents.json").write_text('{"info":{"author":"xcode","version":1}}\\n')
entries = []
for s in sizes:
for scale in (1, 2):
px = s * scale
fname = f"icon_{s}x{s}{'@2x' if scale==2 else ''}.png"
light_src.resize((px, px), Image.Resampling.LANCZOS).save(appicon / fname)
entries.append({"filename": fname, "idiom": "mac", "scale": f"{scale}x", "size": f"{s}x{s}"})
fname_d = f"icon_{s}x{s}{'@2x' if scale==2 else ''}_dark.png"
dark_src.resize((px, px), Image.Resampling.LANCZOS).save(appicon / fname_d)
entries.append({
"filename": fname_d, "idiom": "mac", "scale": f"{scale}x", "size": f"{s}x{s}",
"appearances": [{"appearance": "luminosity", "value": "dark"}],
})
(appicon / "Contents.json").write_text(json.dumps({
"images": entries, "info": {"author": "xcode", "version": 1}
}, indent=2) + "\\n")
print("icons generated:", icns, dark_icns, "catalog entries", len(entries))
PY