From 0b689c281308f0c44a14e98374e6ee6cbf3f2e48 Mon Sep 17 00:00:00 2001 From: Felipe Castillo <1280530+fcastilloec@users.noreply.github.com> Date: Tue, 19 May 2020 13:07:36 -0700 Subject: [PATCH] feat(installer): add support for symbolic icons (#70) Co-authored-by: Mark Lee --- src/installer.js | 5 +++-- test/installer.js | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/installer.js b/src/installer.js index 794ab51..d4eb491 100644 --- a/src/installer.js +++ b/src/installer.js @@ -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)) })) diff --git a/test/installer.js b/test/installer.js index c1a94a6..57f8e63 100644 --- a/test/installer.js +++ b/test/installer.js @@ -43,6 +43,7 @@ test('copyLinuxIcons for hicolor icons', async t => { name: 'icontest', icon: { scalable: img, + symbolic: img, '48x48': img } }) @@ -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 => {