App icon for Linux (#2116)

Summary:
Fixes https://github.com/facebook/flipper/issues/1369
It seems that electron-builder has an issue when trying to set the app icon for Linux zip builds. A workaround for this is to set `icon` option for `BrowserWindow`.

I created a new PNG file for this, it seems that 64x64 looks the best.

## Changelog

App icon for Linux fixed.

Pull Request resolved: https://github.com/facebook/flipper/pull/2116

Test Plan: ![Screenshot from 2021-03-29 13-50-48](https://user-images.githubusercontent.com/490260/112826545-d00d6e00-9095-11eb-984f-227e923f275e.png)

Reviewed By: mweststrate

Differential Revision: D27461758

Pulled By: passy

fbshipit-source-id: 0be3d6b356d1332e89c3df6c137269900417f9ba
This commit is contained in:
Tuomas Jaakola
2021-03-31 06:32:14 -07:00
committed by Facebook GitHub Bot
parent a501838650
commit 3a0d6a3acc
3 changed files with 8 additions and 5 deletions

View File

@@ -11,9 +11,6 @@
"asarUnpack": [ "asarUnpack": [
"PortForwardingMacApp.app/**/*" "PortForwardingMacApp.app/**/*"
], ],
"deb": {
"icon": "icon.icns"
},
"dmg": { "dmg": {
"background": "dmgBackground.png", "background": "dmgBackground.png",
"contents": [ "contents": [
@@ -46,8 +43,7 @@
} }
], ],
"linux": { "linux": {
"category": "Development", "category": "Development"
"icon": "icon.icns"
}, },
"mac": { "mac": {
"category": "public.app-category.developer-tools", "category": "public.app-category.developer-tools",

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -18,6 +18,7 @@ import {
globalShortcut, globalShortcut,
session, session,
} from 'electron'; } from 'electron';
import os from 'os';
import path from 'path'; import path from 'path';
import url from 'url'; import url from 'url';
import fs from 'fs'; import fs from 'fs';
@@ -279,6 +280,12 @@ function createWindow() {
minWidth: 800, minWidth: 800,
minHeight: 600, minHeight: 600,
center: true, center: true,
// The app icon is defined in package.json by default.
// When building Linux zip, it must be defined here or else it won't work.
icon:
os.platform() === 'linux'
? path.join(__dirname, 'icons/app_64x64.png')
: undefined,
webPreferences: { webPreferences: {
enableRemoteModule: true, enableRemoteModule: true,
backgroundThrottling: false, backgroundThrottling: false,