diff --git a/packages/notifier-macos/assets/AppIcon.svg b/packages/notifier-macos/assets/AppIcon.svg new file mode 100644 index 000000000..a3fba9ecc --- /dev/null +++ b/packages/notifier-macos/assets/AppIcon.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/notifier-macos/package.json b/packages/notifier-macos/package.json index db2840802..5b5a760b1 100644 --- a/packages/notifier-macos/package.json +++ b/packages/notifier-macos/package.json @@ -15,6 +15,7 @@ }, "files": [ "dist", + "assets", "src", "scripts" ], diff --git a/packages/notifier-macos/scripts/build.mjs b/packages/notifier-macos/scripts/build.mjs index ecd491df2..e483fabab 100644 --- a/packages/notifier-macos/scripts/build.mjs +++ b/packages/notifier-macos/scripts/build.mjs @@ -15,6 +15,7 @@ const macOsDir = resolve(contentsDir, "MacOS"); const resourcesDir = resolve(contentsDir, "Resources"); const executablePath = resolve(macOsDir, "ao-notifier"); const swiftSource = resolve(packageDir, "src", "AONotifier.swift"); +const sourceIconSvg = resolve(packageDir, "assets", "AppIcon.svg"); function commandExists(command) { try { @@ -129,8 +130,30 @@ function writeIcon() { rmSync(iconsetDir, { recursive: true, force: true }); mkdirSync(iconsetDir, { recursive: true }); const sizes = [16, 32, 64, 128, 256, 512, 1024]; - for (const size of sizes) { - writeFileSync(resolve(iconsetDir, `icon_${size}x${size}.png`), makePng(size)); + + const canRenderSvgIcon = existsSync(sourceIconSvg) && commandExists("sips"); + if (canRenderSvgIcon) { + for (const size of sizes) { + execFileSync( + "sips", + [ + "-s", + "format", + "png", + "--resampleHeightWidth", + String(size), + String(size), + sourceIconSvg, + "--out", + resolve(iconsetDir, `icon_${size}x${size}.png`), + ], + { stdio: "ignore" }, + ); + } + } else { + for (const size of sizes) { + writeFileSync(resolve(iconsetDir, `icon_${size}x${size}.png`), makePng(size)); + } } if (process.platform === "darwin" && commandExists("iconutil")) {