diff options
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 | ||