diff --git a/main.js b/main.js index 7e9ef229c..7978b2a6c 100644 --- a/main.js +++ b/main.js @@ -77,6 +77,9 @@ menubarApp.on('ready', () => { } } }); + ipcMain.on('get-platform', (event) => { + event.returnValue = process.platform; + }); menubarApp.window.webContents.on('devtools-opened', () => { menubarApp.window.setSize(800, 600); diff --git a/src/__mocks__/electron.js b/src/__mocks__/electron.js index 82251d541..a5e69b633 100644 --- a/src/__mocks__/electron.js +++ b/src/__mocks__/electron.js @@ -31,6 +31,7 @@ module.exports = { ipcRenderer: { send: jest.fn(), on: jest.fn(), + sendSync: () => 'darwin', }, shell: { openExternal: jest.fn(), diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx index 1e3c118ce..25d278885 100644 --- a/src/routes/Settings.tsx +++ b/src/routes/Settings.tsx @@ -14,7 +14,8 @@ import { IconQuit } from '../icons/Quit'; import { updateTrayIcon } from '../utils/comms'; import { setAppearance } from '../utils/appearance'; -const isLinux = remote.process.platform === 'linux'; +const platform = ipcRenderer.sendSync('get-platform'); +const isLinux = platform === 'linux'; export const SettingsRoute: React.FC = () => { const { settings, updateSetting, logout } = useContext(AppContext);