Skip to content

Commit

Permalink
feat(installer): add support for symbolic icons (#70)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Lee <[email protected]>
  • Loading branch information
fcastilloec and malept authored May 19, 2020
1 parent 4eb5140 commit 0b689c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ class ElectronInstaller {
*/
async copyHicolorIcons () {
return Promise.all(_.map(this.options.icon, (iconSrc, resolution) => {
const iconExt = resolution === 'scalable' ? 'svg' : 'png'
const iconFile = path.join(this.stagingDir, this.baseAppDir, 'share', 'icons', 'hicolor', resolution, 'apps', `${this.appIdentifier}.${iconExt}`)
const iconExt = ['scalable', 'symbolic'].includes(resolution) ? 'svg' : 'png'
const iconName = resolution === 'symbolic' ? `${this.appIdentifier}-symbolic` : this.appIdentifier
const iconFile = path.join(this.stagingDir, this.baseAppDir, 'share', 'icons', 'hicolor', resolution, 'apps', `${iconName}.${iconExt}`)

return error.wrapError('creating hicolor icon file', async () => this.copyIcon(iconSrc, iconFile))
}))
Expand Down
2 changes: 2 additions & 0 deletions test/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ test('copyLinuxIcons for hicolor icons', async t => {
name: 'icontest',
icon: {
scalable: img,
symbolic: img,
'48x48': img
}
})
Expand All @@ -51,6 +52,7 @@ test('copyLinuxIcons for hicolor icons', async t => {
await installer.copyLinuxIcons()
await util.assertPathExists(t, path.join(installer.stagingDir, hicolorDir, '48x48', 'apps', 'icontest.png'))
await util.assertPathExists(t, path.join(installer.stagingDir, hicolorDir, 'scalable', 'apps', 'icontest.svg'))
await util.assertPathExists(t, path.join(installer.stagingDir, hicolorDir, 'symbolic', 'apps', 'icontest-symbolic.svg'))
})

test('copyLinuxIcons for pixmap', async t => {
Expand Down

0 comments on commit 0b689c2

Please sign in to comment.