mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-08 01:10:03 +02:00
✨ MacOS icon support
This commit is contained in:
parent
f6cd3b37b2
commit
1a5ec090b8
3 changed files with 35 additions and 2 deletions
|
@ -11,14 +11,15 @@ import {
|
|||
writeFileSync,
|
||||
copyFileSync,
|
||||
} from 'fs'
|
||||
import { copyFile, readFile, writeFile } from 'fs/promises'
|
||||
import { copyFile, readFile, rmdir, writeFile } from 'fs/promises'
|
||||
import { every } from 'modern-async'
|
||||
import { dirname, extname, join } from 'path'
|
||||
import sharp from 'sharp'
|
||||
import pngToIco from 'png-to-ico'
|
||||
import asyncIcns from 'async-icns'
|
||||
|
||||
import { config } from '../..'
|
||||
import { CONFIGS_DIR, ENGINE_DIR } from '../../constants'
|
||||
import { CONFIGS_DIR, ENGINE_DIR, MELON_TMP_DIR } from '../../constants'
|
||||
import { log } from '../../log'
|
||||
import {
|
||||
addHash,
|
||||
|
@ -76,6 +77,9 @@ function constructConfig(name: string) {
|
|||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Main code
|
||||
|
||||
async function setupImages(configPath: string, outputPath: string) {
|
||||
log.debug('Generating icons')
|
||||
|
||||
|
@ -93,6 +97,7 @@ async function setupImages(configPath: string, outputPath: string) {
|
|||
return true
|
||||
})
|
||||
|
||||
log.debug('Generating Windows Icons')
|
||||
writeFileSync(
|
||||
join(outputPath, 'firefox.ico'),
|
||||
await pngToIco([join(configPath, 'logo512.png')])
|
||||
|
@ -102,6 +107,21 @@ async function setupImages(configPath: string, outputPath: string) {
|
|||
await pngToIco([join(configPath, 'logo64.png')])
|
||||
)
|
||||
|
||||
// TODO: Custom MacOS icon support
|
||||
if (process.platform == 'darwin') {
|
||||
log.debug('Generating Mac Icons')
|
||||
const tmp = join(MELON_TMP_DIR, 'macos_icon_info.iconset')
|
||||
|
||||
if (existsSync(tmp)) await rmdir(tmp, { recursive: true })
|
||||
|
||||
asyncIcns.convert({
|
||||
input: join(configPath, 'logo.png'),
|
||||
output: join(outputPath, 'firefox.icns'),
|
||||
sizes: [16, 32, 64, 128, 256, 512],
|
||||
tmpDirectory: tmp,
|
||||
})
|
||||
}
|
||||
|
||||
mkdirSync(join(outputPath, 'content'), { recursive: true })
|
||||
|
||||
await sharp(join(configPath, 'logo.png'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue