Skip to content

Commit 81a8748

Browse files
author
Brendan Mulholland
committed
Fix platform fetching issue
1 parent 46d82b4 commit 81a8748

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ menubarApp.on('ready', () => {
7777
}
7878
}
7979
});
80+
ipcMain.on('get-platform', (event) => {
81+
event.returnValue = process.platform;
82+
});
8083

8184
menubarApp.window.webContents.on('devtools-opened', () => {
8285
menubarApp.window.setSize(800, 600);

src/__mocks__/electron.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = {
3131
ipcRenderer: {
3232
send: jest.fn(),
3333
on: jest.fn(),
34+
sendSync: () => 'darwin',
3435
},
3536
shell: {
3637
openExternal: jest.fn(),

src/routes/Settings.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { IconQuit } from '../icons/Quit';
1414
import { updateTrayIcon } from '../utils/comms';
1515
import { setAppearance } from '../utils/appearance';
1616

17-
const isLinux = remote.process.platform === 'linux';
17+
const platform = ipcRenderer.sendSync('get-platform');
18+
const isLinux = platform === 'linux';
1819

1920
export const SettingsRoute: React.FC = () => {
2021
const { settings, updateSetting, logout } = useContext(AppContext);

0 commit comments

Comments
 (0)