diff options
author | 2017-11-20 14:20:33 +0100 | |
---|---|---|
committer | 2017-11-20 14:20:33 +0100 | |
commit | 9e9a2eddd11d2ff8481c1e66215d916a50995f0c (patch) | |
tree | f66289aa52874fcba22fac0f0976b0d56affa8de /src/lib/TouchBar.js | |
parent | fix(Sidebar): Fix sidebar tab sorting (@josescgar) (diff) | |
download | ferdium-app-9e9a2eddd11d2ff8481c1e66215d916a50995f0c.tar.gz ferdium-app-9e9a2eddd11d2ff8481c1e66215d916a50995f0c.tar.zst ferdium-app-9e9a2eddd11d2ff8481c1e66215d916a50995f0c.zip |
fix(macOS): Fix touchbar related crash on macOS 10.12.1 and lower
Closes #70
Diffstat (limited to 'src/lib/TouchBar.js')
-rw-r--r-- | src/lib/TouchBar.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/TouchBar.js b/src/lib/TouchBar.js index ad7849b8e..6831c7870 100644 --- a/src/lib/TouchBar.js +++ b/src/lib/TouchBar.js | |||
@@ -1,3 +1,5 @@ | |||
1 | import os from 'os'; | ||
2 | import semver from 'semver'; | ||
1 | import { remote } from 'electron'; | 3 | import { remote } from 'electron'; |
2 | import { autorun } from 'mobx'; | 4 | import { autorun } from 'mobx'; |
3 | 5 | ||
@@ -8,17 +10,23 @@ export default class FranzTouchBar { | |||
8 | this.stores = stores; | 10 | this.stores = stores; |
9 | this.actions = actions; | 11 | this.actions = actions; |
10 | 12 | ||
11 | this._initializeReactions(); | 13 | // Temporary fix for https://github.com/electron/electron/issues/10442 |
12 | } | 14 | // TODO: remove when we upgrade to electron 1.8.2 or later |
13 | 15 | try { | |
14 | _initializeReactions() { | 16 | if (isMac && semver.gt(os.release(), '16.6.0')) { |
15 | this.build = autorun(this._build.bind(this)); | 17 | this.build = autorun(this._build.bind(this)); |
18 | } | ||
19 | } catch (err) { | ||
20 | console.error(err); | ||
21 | } | ||
16 | } | 22 | } |
17 | 23 | ||
18 | _build() { | 24 | _build() { |
19 | const currentWindow = remote.getCurrentWindow(); | 25 | const currentWindow = remote.getCurrentWindow(); |
20 | 26 | ||
21 | if (isMac && this.stores.user.isLoggedIn) { | 27 | currentWindow._setEscapeTouchBarItem = () => {}; |
28 | |||
29 | if (this.stores.user.isLoggedIn) { | ||
22 | const { TouchBar } = remote; | 30 | const { TouchBar } = remote; |
23 | const { TouchBarButton, TouchBarSpacer } = TouchBar; | 31 | const { TouchBarButton, TouchBarSpacer } = TouchBar; |
24 | 32 | ||