aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package-lock.json108
-rw-r--r--package.json1
-rw-r--r--src/components/settings/settings/EditSettingsForm.js8
-rw-r--r--src/electron/ipc-api/appIndicator.js14
-rw-r--r--src/electron/ipc-api/autoUpdate.js3
-rw-r--r--src/helpers/userAgent-helpers.js2
-rw-r--r--src/index.js7
-rw-r--r--src/lib/DBus.js8
-rw-r--r--src/lib/Menu.js5
-rw-r--r--src/lib/Tray.js16
-rw-r--r--src/webview/contextMenuBuilder.js4
11 files changed, 140 insertions, 36 deletions
diff --git a/package-lock.json b/package-lock.json
index f5cf5acb0..0c3e2357d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21459,8 +21459,7 @@
21459 "human-signals": { 21459 "human-signals": {
21460 "version": "1.1.1", 21460 "version": "1.1.1",
21461 "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", 21461 "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
21462 "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", 21462 "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw=="
21463 "dev": true
21464 }, 21463 },
21465 "humanize-ms": { 21464 "humanize-ms": {
21466 "version": "1.2.1", 21465 "version": "1.2.1",
@@ -26134,6 +26133,11 @@
26134 } 26133 }
26135 } 26134 }
26136 }, 26135 },
26136 "macos-release": {
26137 "version": "2.4.1",
26138 "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.4.1.tgz",
26139 "integrity": "sha512-H/QHeBIN1fIGJX517pvK8IEK53yQOW7YcEI55oYtgjDdoCQQz7eJS94qt5kNrscReEyuD/JcdFCm2XBEcGOITg=="
26140 },
26137 "macos-version": { 26141 "macos-version": {
26138 "version": "5.2.0", 26142 "version": "5.2.0",
26139 "resolved": "https://registry.npmjs.org/macos-version/-/macos-version-5.2.0.tgz", 26143 "resolved": "https://registry.npmjs.org/macos-version/-/macos-version-5.2.0.tgz",
@@ -29157,6 +29161,15 @@
29157 "mem": "^4.0.0" 29161 "mem": "^4.0.0"
29158 } 29162 }
29159 }, 29163 },
29164 "os-name": {
29165 "version": "4.0.0",
29166 "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.0.tgz",
29167 "integrity": "sha512-caABzDdJMbtykt7GmSogEat3faTKQhmZf0BS5l/pZGmP0vPWQjXWqOhbLyK+b6j2/DQPmEvYdzLXJXXLJNVDNg==",
29168 "requires": {
29169 "macos-release": "^2.2.0",
29170 "windows-release": "^4.0.0"
29171 }
29172 },
29160 "os-tmpdir": { 29173 "os-tmpdir": {
29161 "version": "1.0.2", 29174 "version": "1.0.2",
29162 "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", 29175 "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
@@ -36185,6 +36198,97 @@
36185 "nan": "^2.7.0" 36198 "nan": "^2.7.0"
36186 } 36199 }
36187 }, 36200 },
36201 "windows-release": {
36202 "version": "4.0.0",
36203 "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-4.0.0.tgz",
36204 "integrity": "sha512-OxmV4wzDKB1x7AZaZgXMVsdJ1qER1ed83ZrTYd5Bwq2HfJVg3DJS8nqlAG4sMoJ7mu8cuRmLEYyU13BKwctRAg==",
36205 "requires": {
36206 "execa": "^4.0.2"
36207 },
36208 "dependencies": {
36209 "cross-spawn": {
36210 "version": "7.0.3",
36211 "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
36212 "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
36213 "requires": {
36214 "path-key": "^3.1.0",
36215 "shebang-command": "^2.0.0",
36216 "which": "^2.0.1"
36217 }
36218 },
36219 "execa": {
36220 "version": "4.1.0",
36221 "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",
36222 "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==",
36223 "requires": {
36224 "cross-spawn": "^7.0.0",
36225 "get-stream": "^5.0.0",
36226 "human-signals": "^1.1.1",
36227 "is-stream": "^2.0.0",
36228 "merge-stream": "^2.0.0",
36229 "npm-run-path": "^4.0.0",
36230 "onetime": "^5.1.0",
36231 "signal-exit": "^3.0.2",
36232 "strip-final-newline": "^2.0.0"
36233 }
36234 },
36235 "get-stream": {
36236 "version": "5.2.0",
36237 "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
36238 "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
36239 "requires": {
36240 "pump": "^3.0.0"
36241 }
36242 },
36243 "is-stream": {
36244 "version": "2.0.0",
36245 "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
36246 "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw=="
36247 },
36248 "npm-run-path": {
36249 "version": "4.0.1",
36250 "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
36251 "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
36252 "requires": {
36253 "path-key": "^3.0.0"
36254 }
36255 },
36256 "onetime": {
36257 "version": "5.1.2",
36258 "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
36259 "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
36260 "requires": {
36261 "mimic-fn": "^2.1.0"
36262 }
36263 },
36264 "path-key": {
36265 "version": "3.1.1",
36266 "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
36267 "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
36268 },
36269 "shebang-command": {
36270 "version": "2.0.0",
36271 "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
36272 "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
36273 "requires": {
36274 "shebang-regex": "^3.0.0"
36275 }
36276 },
36277 "shebang-regex": {
36278 "version": "3.0.0",
36279 "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
36280 "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
36281 },
36282 "which": {
36283 "version": "2.0.2",
36284 "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
36285 "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
36286 "requires": {
36287 "isexe": "^2.0.0"
36288 }
36289 }
36290 }
36291 },
36188 "winreg": { 36292 "winreg": {
36189 "version": "1.2.4", 36293 "version": "1.2.4",
36190 "resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.4.tgz", 36294 "resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.4.tgz",
diff --git a/package.json b/package.json
index 6c73b5d8d..90405650d 100644
--- a/package.json
+++ b/package.json
@@ -106,6 +106,7 @@
106 "ms": "2.1.2", 106 "ms": "2.1.2",
107 "node-fetch": "2.6.1", 107 "node-fetch": "2.6.1",
108 "normalize-url": "5.0.0", 108 "normalize-url": "5.0.0",
109 "os-name": "4.0.0",
109 "pretty-bytes": "^5.6.0", 110 "pretty-bytes": "^5.6.0",
110 "prop-types": "^15.5.10", 111 "prop-types": "^15.5.10",
111 "react": "16.12.0", 112 "react": "16.12.0",
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index c1a99e5fc..092411ec2 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -13,7 +13,7 @@ import PremiumFeatureContainer from '../../ui/PremiumFeatureContainer';
13import Input from '../../ui/Input'; 13import Input from '../../ui/Input';
14 14
15import { FRANZ_TRANSLATION } from '../../../config'; 15import { FRANZ_TRANSLATION } from '../../../config';
16import { isMac } from '../../../environment'; 16import { isMac, isWindows } from '../../../environment';
17 17
18const { 18const {
19 systemPreferences, 19 systemPreferences,
@@ -304,14 +304,14 @@ export default @observer class EditSettingsForm extends Component {
304 <Toggle field={form.$('enableSystemTray')} /> 304 <Toggle field={form.$('enableSystemTray')} />
305 <Toggle field={form.$('reloadAfterResume')} /> 305 <Toggle field={form.$('reloadAfterResume')} />
306 <Toggle field={form.$('startMinimized')} /> 306 <Toggle field={form.$('startMinimized')} />
307 {process.platform === 'win32' && ( 307 {isWindows && (
308 <Toggle field={form.$('minimizeToSystemTray')} /> 308 <Toggle field={form.$('minimizeToSystemTray')} />
309 )} 309 )}
310 {process.platform === 'win32' && ( 310 {isWindows && (
311 <Toggle field={form.$('closeToSystemTray')} /> 311 <Toggle field={form.$('closeToSystemTray')} />
312 )} 312 )}
313 <Toggle field={form.$('privateNotifications')} /> 313 <Toggle field={form.$('privateNotifications')} />
314 {(process.platform === 'win32' || process.platform === 'darwin') && ( 314 {(isWindows || isMac) && (
315 <Toggle field={form.$('notifyTaskBarOnMessage')} />)} 315 <Toggle field={form.$('notifyTaskBarOnMessage')} />)}
316 <Select field={form.$('navigationBarBehaviour')} /> 316 <Select field={form.$('navigationBarBehaviour')} />
317 317
diff --git a/src/electron/ipc-api/appIndicator.js b/src/electron/ipc-api/appIndicator.js
index 70f14d95e..0691e5170 100644
--- a/src/electron/ipc-api/appIndicator.js
+++ b/src/electron/ipc-api/appIndicator.js
@@ -1,9 +1,10 @@
1import { app, ipcMain } from 'electron'; 1import { app, ipcMain } from 'electron';
2import path from 'path'; 2import path from 'path';
3import { autorun } from 'mobx'; 3import { autorun } from 'mobx';
4import { isMac, isWindows, isLinux } from '../../environment';
4 5
5const INDICATOR_TASKBAR = 'taskbar'; 6const INDICATOR_TASKBAR = 'taskbar';
6const FILE_EXTENSION = process.platform === 'win32' ? 'ico' : 'png'; 7const FILE_EXTENSION = isWindows ? 'ico' : 'png';
7 8
8let isTrayIconEnabled; 9let isTrayIconEnabled;
9 10
@@ -28,29 +29,28 @@ export default (params) => {
28 // Flash TaskBar for windows, bounce Dock on Mac 29 // Flash TaskBar for windows, bounce Dock on Mac
29 if (!app.mainWindow.isFocused()) { 30 if (!app.mainWindow.isFocused()) {
30 if (params.settings.app.get('notifyTaskBarOnMessage')) { 31 if (params.settings.app.get('notifyTaskBarOnMessage')) {
31 if (process.platform === 'win32') { 32 if (isWindows) {
32 app.mainWindow.flashFrame(true); 33 app.mainWindow.flashFrame(true);
33 app.mainWindow.once('focus', () => app.mainWindow.flashFrame(false)); 34 app.mainWindow.once('focus', () => app.mainWindow.flashFrame(false));
34 } else if (process.platform === 'darwin') { 35 } else if (isMac) {
35 app.dock.bounce('informational'); 36 app.dock.bounce('informational');
36 } 37 }
37 } 38 }
38 } 39 }
39 40
40 // Update badge 41 // Update badge
41 if (process.platform === 'darwin' 42 if (isMac
42 && typeof (args.indicator) === 'string') { 43 && typeof (args.indicator) === 'string') {
43 app.dock.setBadge(args.indicator); 44 app.dock.setBadge(args.indicator);
44 } 45 }
45 46
46 if ((process.platform === 'darwin' 47 if ((isMac || isLinux)
47 || process.platform === 'linux')
48 && typeof (args.indicator) === 'number' 48 && typeof (args.indicator) === 'number'
49 ) { 49 ) {
50 app.badgeCount = args.indicator; 50 app.badgeCount = args.indicator;
51 } 51 }
52 52
53 if (process.platform === 'win32') { 53 if (isWindows) {
54 if (typeof args.indicator === 'number' 54 if (typeof args.indicator === 'number'
55 && args.indicator !== 0) { 55 && args.indicator !== 0) {
56 params.mainWindow.setOverlayIcon( 56 params.mainWindow.setOverlayIcon(
diff --git a/src/electron/ipc-api/autoUpdate.js b/src/electron/ipc-api/autoUpdate.js
index a81bc918f..ec7fa9d8a 100644
--- a/src/electron/ipc-api/autoUpdate.js
+++ b/src/electron/ipc-api/autoUpdate.js
@@ -1,5 +1,6 @@
1import { app, ipcMain } from 'electron'; 1import { app, ipcMain } from 'electron';
2import { autoUpdater } from 'electron-updater'; 2import { autoUpdater } from 'electron-updater';
3import { isMac, isWindows } from '../../environment';
3 4
4const debug = require('debug')('Ferdi:ipcApi:autoUpdate'); 5const debug = require('debug')('Ferdi:ipcApi:autoUpdate');
5 6
@@ -9,7 +10,7 @@ export default (params) => {
9 if (!enableUpdate) { 10 if (!enableUpdate) {
10 autoUpdater.autoInstallOnAppQuit = false; 11 autoUpdater.autoInstallOnAppQuit = false;
11 autoUpdater.autoDownload = false; 12 autoUpdater.autoDownload = false;
12 } else if (process.platform === 'darwin' || process.platform === 'win32' || process.env.APPIMAGE) { 13 } else if (isMac || isWindows || process.env.APPIMAGE) {
13 ipcMain.on('autoUpdate', (event, args) => { 14 ipcMain.on('autoUpdate', (event, args) => {
14 if (enableUpdate) { 15 if (enableUpdate) {
15 try { 16 try {
diff --git a/src/helpers/userAgent-helpers.js b/src/helpers/userAgent-helpers.js
index be6162464..fd0d16e2d 100644
--- a/src/helpers/userAgent-helpers.js
+++ b/src/helpers/userAgent-helpers.js
@@ -5,7 +5,7 @@ import { isMac, isWindows } from '../environment';
5 5
6// This helper gets included from the backend and frontend but we only need to use "remote" 6// This helper gets included from the backend and frontend but we only need to use "remote"
7// if we are in the frontend 7// if we are in the frontend
8const ferdiVersion = remote && remote.app ? remote.app.getVersion() : app.getVersion(); 8export const ferdiVersion = remote && remote.app ? remote.app.getVersion() : app.getVersion();
9 9
10function macOS() { 10function macOS() {
11 const version = macosVersion(); 11 const version = macosVersion();
diff --git a/src/index.js b/src/index.js
index a93040895..0fac386df 100644
--- a/src/index.js
+++ b/src/index.js
@@ -51,8 +51,9 @@ import {
51} from './config'; 51} from './config';
52import { asarPath } from './helpers/asar-helpers'; 52import { asarPath } from './helpers/asar-helpers';
53import { isValidExternalURL } from './helpers/url-helpers'; 53import { isValidExternalURL } from './helpers/url-helpers';
54import userAgent from './helpers/userAgent-helpers'; 54import userAgent, { ferdiVersion } from './helpers/userAgent-helpers';
55 55
56const osName = require('os-name');
56const debug = require('debug')('Ferdi:App'); 57const debug = require('debug')('Ferdi:App');
57 58
58// From Electron 9 onwards, app.allowRendererProcessReuse = true by default. This causes the app to crash on Windows due to the 59// From Electron 9 onwards, app.allowRendererProcessReuse = true by default. This causes the app to crash on Windows due to the
@@ -162,7 +163,7 @@ if (!settings.get('enableGPUAcceleration')) {
162} 163}
163 164
164app.setAboutPanelOptions({ 165app.setAboutPanelOptions({
165 applicationVersion: `Version: ${app.getVersion()}\nElectron: ${process.versions.electron}\nNode.js: ${process.version}\nPlatform: ${process.platform}\nArch: ${process.arch}\nBuild date: ${new Date(Number(buildInfo.timestamp))}\nGit SHA: ${buildInfo.gitHashShort}\nGit branch: ${buildInfo.gitBranch}`, 166 applicationVersion: `Version: ${ferdiVersion}\nElectron: ${process.versions.electron}\nNode.js: ${process.version}\nPlatform: ${osName()}\nArch: ${process.arch}\nBuild date: ${new Date(Number(buildInfo.timestamp))}\nGit SHA: ${buildInfo.gitHashShort}\nGit branch: ${buildInfo.gitBranch}`,
166 version: '', 167 version: '',
167}); 168});
168 169
@@ -394,7 +395,7 @@ app.on('ready', () => {
394 app.setAsDefaultProtocolClient('ferdi-dev'); 395 app.setAsDefaultProtocolClient('ferdi-dev');
395 } 396 }
396 397
397 if (process.platform === 'win32') { 398 if (isWindows) {
398 app.setUserTasks([{ 399 app.setUserTasks([{
399 program: process.execPath, 400 program: process.execPath,
400 arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`, 401 arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`,
diff --git a/src/lib/DBus.js b/src/lib/DBus.js
index 957912efa..9baaea014 100644
--- a/src/lib/DBus.js
+++ b/src/lib/DBus.js
@@ -1,9 +1,5 @@
1import { 1import { sessionBus } from 'dbus-next';
2 sessionBus, 2import { isLinux } from '../environment';
3} from 'dbus-next';
4import {
5 isLinux,
6} from '../environment';
7 3
8export default class DBus { 4export default class DBus {
9 bus = null; 5 bus = null;
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index d85f5706c..7bd273f6f 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -10,6 +10,9 @@ import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants';
10import { workspaceActions } from '../features/workspaces/actions'; 10import { workspaceActions } from '../features/workspaces/actions';
11import { workspaceStore } from '../features/workspaces/index'; 11import { workspaceStore } from '../features/workspaces/index';
12import * as buildInfo from '../buildInfo.json'; // eslint-disable-line import/no-unresolved 12import * as buildInfo from '../buildInfo.json'; // eslint-disable-line import/no-unresolved
13import { ferdiVersion } from '../helpers/userAgent-helpers';
14
15const osName = require('os-name');
13 16
14const { 17const {
15 app, Menu, dialog, systemPreferences, 18 app, Menu, dialog, systemPreferences,
@@ -1025,7 +1028,7 @@ export default class FranzMenu {
1025 type: 'info', 1028 type: 'info',
1026 title: 'Franz Ferdinand', 1029 title: 'Franz Ferdinand',
1027 message: 'Ferdi', 1030 message: 'Ferdi',
1028 detail: `Version: ${remote.app.getVersion()}\nElectron: ${process.versions.electron}\nNode.js: ${process.version}\nPlatform: ${process.platform}\nArch: ${process.arch}\nBuild date: ${new Date(Number(buildInfo.timestamp))}\nGit SHA: ${buildInfo.gitHashShort}\nGit branch: ${buildInfo.gitBranch}`, 1031 detail: `Version: ${ferdiVersion}\nElectron: ${process.versions.electron}\nNode.js: ${process.version}\nPlatform: ${osName()}\nArch: ${process.arch}\nBuild date: ${new Date(Number(buildInfo.timestamp))}\nGit SHA: ${buildInfo.gitHashShort}\nGit branch: ${buildInfo.gitBranch}`,
1029 }); 1032 });
1030 }, 1033 },
1031 }; 1034 };
diff --git a/src/lib/Tray.js b/src/lib/Tray.js
index 36f0de66d..f37b4eb7b 100644
--- a/src/lib/Tray.js
+++ b/src/lib/Tray.js
@@ -3,13 +3,9 @@ import {
3} from 'electron'; 3} from 'electron';
4import path from 'path'; 4import path from 'path';
5import macosVersion from 'macos-version'; 5import macosVersion from 'macos-version';
6import { 6import { isMac, isWindows, isLinux } from '../environment';
7 isMac,
8 isWindows,
9 isLinux,
10} from '../environment';
11 7
12const FILE_EXTENSION = process.platform === 'win32' ? 'ico' : 'png'; 8const FILE_EXTENSION = isWindows ? 'ico' : 'png';
13const INDICATOR_TRAY_PLAIN = 'tray'; 9const INDICATOR_TRAY_PLAIN = 'tray';
14const INDICATOR_TRAY_UNREAD = 'tray-unread'; 10const INDICATOR_TRAY_UNREAD = 'tray-unread';
15const INDICATOR_TRAY_INDIRECT = 'tray-indirect'; 11const INDICATOR_TRAY_INDIRECT = 'tray-indirect';
@@ -110,7 +106,7 @@ export default class TrayIcon {
110 }); 106 });
111 } 107 }
112 108
113 if (process.platform === 'darwin') { 109 if (isMac) {
114 this.themeChangeSubscriberId = systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { 110 this.themeChangeSubscriberId = systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => {
115 this._refreshIcon(); 111 this._refreshIcon();
116 }); 112 });
@@ -128,7 +124,7 @@ export default class TrayIcon {
128 this.trayIcon.destroy(); 124 this.trayIcon.destroy();
129 this.trayIcon = null; 125 this.trayIcon = null;
130 126
131 if (process.platform === 'darwin' && this.themeChangeSubscriberId) { 127 if (isMac && this.themeChangeSubscriberId) {
132 systemPreferences.unsubscribeNotification(this.themeChangeSubscriberId); 128 systemPreferences.unsubscribeNotification(this.themeChangeSubscriberId);
133 this.themeChangeSubscriberId = null; 129 this.themeChangeSubscriberId = null;
134 } 130 }
@@ -164,7 +160,7 @@ export default class TrayIcon {
164 160
165 this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); 161 this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator)));
166 162
167 if (process.platform === 'darwin') { 163 if (isMac) {
168 this.trayIcon.setPressedImage( 164 this.trayIcon.setPressedImage(
169 this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), 165 this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`),
170 ); 166 );
@@ -174,7 +170,7 @@ export default class TrayIcon {
174 _getAsset(type, asset) { 170 _getAsset(type, asset) {
175 let { platform } = process; 171 let { platform } = process;
176 172
177 if (platform === 'darwin' && (nativeTheme.shouldUseDarkColors || macosVersion.isGreaterThanOrEqualTo('11'))) { 173 if (isMac && (nativeTheme.shouldUseDarkColors || macosVersion.isGreaterThanOrEqualTo('11'))) {
178 platform = `${platform}-dark`; 174 platform = `${platform}-dark`;
179 } 175 }
180 176
diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js
index 7980e5344..f7d552ddd 100644
--- a/src/webview/contextMenuBuilder.js
+++ b/src/webview/contextMenuBuilder.js
@@ -6,6 +6,8 @@
6 * 6 *
7 * Source: https://github.com/electron-userland/electron-spellchecker/blob/master/src/context-menu-builder.js 7 * Source: https://github.com/electron-userland/electron-spellchecker/blob/master/src/context-menu-builder.js
8 */ 8 */
9import { isMac } from '../environment';
10
9const { 11const {
10 clipboard, nativeImage, remote, shell, 12 clipboard, nativeImage, remote, shell,
11} = require('electron'); 13} = require('electron');
@@ -261,7 +263,7 @@ module.exports = class ContextMenuBuilder {
261 return menu; 263 return menu;
262 } 264 }
263 265
264 if (process.platform === 'darwin') { 266 if (isMac) {
265 const webContents = this.getWebContents(); 267 const webContents = this.getWebContents();
266 268
267 const lookUpDefinition = new MenuItem({ 269 const lookUpDefinition = new MenuItem({