Wire PearDock branding into app, Electron icons, and README
Release rolling / release (push) Has been cancelled
Release rolling / release (push) Has been cancelled
Copy runtime logos/favicons into assets/ and package icons into build/, then use them for the titlebar, favicons, dock/window icons, and docs so packaging and the UI no longer rely on placeholder marks.
This commit is contained in:
+29
-1
@@ -85,6 +85,8 @@ function startStaticServer(rootDir) {
|
||||
'.cjs': 'text/javascript; charset=utf-8',
|
||||
'.css': 'text/css; charset=utf-8',
|
||||
'.json': 'application/json',
|
||||
'.webmanifest': 'application/manifest+json',
|
||||
'.xml': 'application/xml',
|
||||
'.svg': 'image/svg+xml',
|
||||
'.png': 'image/png',
|
||||
'.jpg': 'image/jpeg',
|
||||
@@ -207,12 +209,28 @@ async function startHolesailControl() {
|
||||
}
|
||||
}
|
||||
|
||||
function resolveAppIcon() {
|
||||
const appRoot = app.isPackaged ? app.getAppPath() : path.resolve(__dirname, '..')
|
||||
// Packaged: electron-packager embeds platform icon; still set window icon for Linux/Win.
|
||||
const candidates = [
|
||||
path.join(appRoot, 'build', process.platform === 'win32' ? 'icon.ico' : 'icon.png'),
|
||||
path.join(appRoot, 'build', 'icon.png'),
|
||||
path.join(appRoot, 'assets', 'logo', 'peardock-icon-256.png'),
|
||||
]
|
||||
for (const p of candidates) {
|
||||
if (fs.existsSync(p)) return p
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
const icon = resolveAppIcon()
|
||||
const win = new BrowserWindow({
|
||||
width: pkg.pear?.gui?.width || 1280,
|
||||
height: pkg.pear?.gui?.height || 800,
|
||||
backgroundColor: pkg.pear?.gui?.backgroundColor || '#0a0c10',
|
||||
backgroundColor: pkg.pear?.gui?.backgroundColor || '#0f1117',
|
||||
title: appName,
|
||||
...(icon ? { icon } : {}),
|
||||
webPreferences: {
|
||||
preload: buildPreloadPath(),
|
||||
// Full peardock UI imports HyperDHT etc. as ESM node packages — same as pear UI.
|
||||
@@ -264,6 +282,16 @@ app.whenReady().then(async () => {
|
||||
// App root: project root in dev; Electron app path (app.asar or app/) when packaged
|
||||
const appRoot = app.isPackaged ? app.getAppPath() : path.resolve(__dirname, '..')
|
||||
|
||||
// Dock / taskbar icon (packaged macOS uses .icns from forge; this covers dev + Linux/Win)
|
||||
const dockIcon = resolveAppIcon()
|
||||
if (dockIcon && process.platform === 'darwin' && app.dock) {
|
||||
try {
|
||||
app.dock.setIcon(dockIcon)
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
await startStaticServer(appRoot)
|
||||
await startHolesailControl()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user