chore: refresh app icons
Update the Electron icon wiring to use the new assets/icons layout, remove the old app-icon files, and keep Windows packaging pointed at the new platform-specific ico. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Before Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 984 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 41 KiB |
@@ -11,8 +11,8 @@ const outputDirectoryName = 'win-unpacked';
|
||||
const scriptDirectory = dirname(fileURLToPath(import.meta.url));
|
||||
const repositoryRoot = resolve(scriptDirectory, '..');
|
||||
const assetDirectory = join(repositoryRoot, 'assets');
|
||||
const windowsIconPath = join(assetDirectory, 'icons', 'app-icon.ico');
|
||||
const windowIconPath = join(assetDirectory, 'icons', 'app-icon.png');
|
||||
const sourceIconPath = join(assetDirectory, 'icons', 'icon.png');
|
||||
const windowsIconPath = join(assetDirectory, 'icons', 'windows', 'icon.ico');
|
||||
const electronDistributionDirectory = join(repositoryRoot, 'node_modules', 'electron', 'dist');
|
||||
const rendererBuildDirectory = join(repositoryRoot, 'dist');
|
||||
const electronBuildDirectory = join(repositoryRoot, 'dist-electron');
|
||||
@@ -94,7 +94,7 @@ async function main() {
|
||||
|
||||
await Promise.all([
|
||||
ensurePathExists(assetDirectory, 'Application assets'),
|
||||
ensurePathExists(windowIconPath, 'Window icon'),
|
||||
ensurePathExists(sourceIconPath, 'Source application icon'),
|
||||
ensurePathExists(windowsIconPath, 'Windows application icon'),
|
||||
ensurePathExists(electronDistributionDirectory, 'Electron runtime'),
|
||||
ensurePathExists(rendererBuildDirectory, 'Renderer build output'),
|
||||
|
||||
@@ -11,7 +11,14 @@ function getPathModule(platform: NodeJS.Platform) {
|
||||
|
||||
export function resolveWindowIconPath(context: WindowIconPathContext): string {
|
||||
const pathModule = getPathModule(context.platform);
|
||||
const iconFileName = context.platform === 'win32' ? 'app-icon.ico' : 'app-icon.png';
|
||||
|
||||
return pathModule.join(context.appPath, 'assets', 'icons', iconFileName);
|
||||
switch (context.platform) {
|
||||
case 'win32':
|
||||
return pathModule.join(context.appPath, 'assets', 'icons', 'windows', 'icon.ico');
|
||||
case 'darwin':
|
||||
return pathModule.join(context.appPath, 'assets', 'icons', 'macos', 'icon.icns');
|
||||
case 'linux':
|
||||
return pathModule.join(context.appPath, 'assets', 'icons', 'linux', 'icons', '512x512.png');
|
||||
default:
|
||||
return pathModule.join(context.appPath, 'assets', 'icons', 'icon.png');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,30 @@ import { describe, expect, test } from 'bun:test';
|
||||
import { resolveWindowIconPath } from '@main/windows/appIcon';
|
||||
|
||||
describe('resolveWindowIconPath', () => {
|
||||
test('uses the Windows ico asset from the packaged app assets directory', () => {
|
||||
test('uses the Windows ico asset from the platform-specific icon directory', () => {
|
||||
expect(
|
||||
resolveWindowIconPath({
|
||||
appPath: 'C:\\workspace\\personal\\repositories\\kopaya',
|
||||
platform: 'win32',
|
||||
}),
|
||||
).toBe('C:\\workspace\\personal\\repositories\\kopaya\\assets\\icons\\app-icon.ico');
|
||||
).toBe('C:\\workspace\\personal\\repositories\\kopaya\\assets\\icons\\windows\\icon.ico');
|
||||
});
|
||||
|
||||
test('uses the PNG asset on non-Windows platforms', () => {
|
||||
test('uses the macOS icns asset on Darwin', () => {
|
||||
expect(
|
||||
resolveWindowIconPath({
|
||||
appPath: '/Applications/Kopaya.app/Contents/Resources/app',
|
||||
platform: 'darwin',
|
||||
}),
|
||||
).toBe('/Applications/Kopaya.app/Contents/Resources/app/assets/icons/app-icon.png');
|
||||
).toBe('/Applications/Kopaya.app/Contents/Resources/app/assets/icons/macos/icon.icns');
|
||||
});
|
||||
|
||||
test('uses the Linux 512px PNG asset on Linux', () => {
|
||||
expect(
|
||||
resolveWindowIconPath({
|
||||
appPath: '/opt/kopaya/resources/app',
|
||||
platform: 'linux',
|
||||
}),
|
||||
).toBe('/opt/kopaya/resources/app/assets/icons/linux/icons/512x512.png');
|
||||
});
|
||||
});
|
||||
|
||||