Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions desktop/scripts/generate-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,20 @@ const ICNS_ENTRIES: Array<{ name: string; size: number }> = [
/** Sizes packed into the .ico, which stores each one as an embedded PNG. */
const ICO_SIZES = [16, 32, 48, 64, 128, 256];

function render(size: number, out: string): void {
const result = spawnSync("rsvg-convert", ["-w", String(size), "-h", String(size), source, "-o", out]);
/**
* The menu bar image, which is the same mark with no backdrop and the prompt cut through.
*
* It needs its own source because a status item is a template image: macOS reads the alpha as
* coverage and paints it with the menu bar tint, so the backdrop has to be gone rather than
* recoloured. 44px is 22pt at @2x, which is the menu bar working height and the size this asset
* already shipped at.
*/
const TRAY_OUTPUT = "tray/icon.png";
const TRAY_SIZE = 44;
const traySource = join(iconsDir, "tray", "icon.svg");

function render(size: number, out: string, from: string = source): void {
const result = spawnSync("rsvg-convert", ["-w", String(size), "-h", String(size), from, "-o", out]);
if (result.status !== 0) {
const detail = result.error?.message ?? result.stderr?.toString().trim() ?? "unknown error";
throw new Error(`rsvg-convert failed for ${size}px: ${detail}`);
Expand Down Expand Up @@ -131,6 +143,10 @@ function generateInto(target: string): { produced: string[]; icnsSkipped: boolea
writeFileSync(join(target, "icon.ico"), buildIco(icoParts));
produced.push("icon.ico");

mkdirSync(join(target, "tray"), { recursive: true });
render(TRAY_SIZE, join(target, TRAY_OUTPUT), traySource);
produced.push(TRAY_OUTPUT);

return { produced, icnsSkipped };
}

Expand All @@ -139,6 +155,10 @@ function main(): number {
console.error(`[icons] missing source: ${source}`);
return 1;
}
if (!existsSync(traySource)) {
console.error(`[icons] missing source: ${traySource}`);
return 1;
}
const check = process.argv.includes("--check");
if (!check) {
// Render into scratch first so a failure half way through cannot leave the committed set
Expand Down Expand Up @@ -174,7 +194,7 @@ function main(): number {
}
}
if (drifted.length > 0) {
console.error(`[icons] these do not match icon.svg: ${drifted.join(", ")}`);
console.error(`[icons] these do not match their source: ${drifted.join(", ")}`);
console.error("[icons] regenerate with: bun run icons");
return 1;
}
Expand Down
Binary file modified desktop/src-tauri/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/128x128@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square107x107Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square142x142Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square150x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square284x284Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square30x30Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square310x310Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square71x71Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/Square89x89Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/icon.icns
Binary file not shown.
Binary file modified desktop/src-tauri/icons/icon.ico
Binary file not shown.
Binary file modified desktop/src-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 38 additions & 11 deletions desktop/src-tauri/icons/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified desktop/src-tauri/icons/tray/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading