Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Fix segmentation fault (core dumped) bug on Linux #25

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion public/windows/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const {
BrowserWindow,
Menu,
Tray,
app,
ipcMain,
nativeImage,
} = require('electron');
const windowStateKeeper = require('electron-window-state');
const { menubar } = require('menubar');
Expand Down Expand Up @@ -30,9 +32,18 @@ const createAsync = () => new Promise((resolve) => {
defaultHeight: 400,
});

// setImage after Tray instance is created to avoid
// "Segmentation fault (core dumped)" bug on Linux
// https://github.com/electron/electron/issues/22137#issuecomment-586105622
// https://github.com/atomery/translatium/issues/164
const tray = new Tray(nativeImage.createEmpty());
// icon template is not supported on Windows & Linux
const iconPath = path.resolve(__dirname, '..', 'menubar-icon.png');
tray.setImage(iconPath);

mb = menubar({
index: REACT_PATH,
icon: path.resolve(__dirname, '..', 'menubar-icon.png'),
tray,
preloadWindow: true,
tooltip: appJson.name,
browserWindow: {
Expand Down