From 59d4f566a6b34b3157b131b42f529cc00fffcece Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 5 Feb 2021 21:51:41 +0000 Subject: [PATCH] Fix electron shortcuts to enable toggling the developer tools and quitting the application. (https://github.com/enso-org/ide/pull/1173) Original commit: https://github.com/enso-org/ide/commit/8f2a1a23fdcb8d16659363a0edf87d92e5b43c9a --- gui/CHANGELOG.md | 7 +++++-- gui/src/js/lib/client/src/index.js | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gui/CHANGELOG.md b/gui/CHANGELOG.md index 8804325aa7b..8e111f76643 100644 --- a/gui/CHANGELOG.md +++ b/gui/CHANGELOG.md @@ -12,6 +12,8 @@ read the notes of the `Enso 2.0.0-alpha.1` release. - Cursors in text editors behave correctly now (they are not affected by scene pan and zoom). This was possible because of a new multi-camera management system implemented in EnsoGL. - Fixes to some visual glitches, like small "pixel-like" things appearing sometimes on the screen. +- The shortcuts to close the application and to toggle the developer tools at runtime are working + now on all supported platforms. #### EnsoGL - New multi-camera management system, allowing the same shape systems be rendered on different @@ -22,10 +24,11 @@ read the notes of the `Enso 2.0.0-alpha.1` release. - Various performance improvements, especially for the text rendering engine. - Display objects handle visibility correctly now. Display objects are not visible by default and need to be attached to a visible parent to be shown on the screen. -
+ +
- + # Enso 2.0.0-alpha.1 (2020-01-26) This is the first release of Enso, a general-purpose programming language and environment for interactive data processing. It is a tool that spans the entire stack, going from high-level diff --git a/gui/src/js/lib/client/src/index.js b/gui/src/js/lib/client/src/index.js index ac3d5032a3c..4cbe7f34d67 100644 --- a/gui/src/js/lib/client/src/index.js +++ b/gui/src/js/lib/client/src/index.js @@ -534,18 +534,21 @@ if (process.platform === 'darwin') { Electron.app.on('web-contents-created', (webContentsCreatedEvent, webContents) => { webContents.on('before-input-event', (beforeInputEvent, input) => { - const {code,alt,ctrl,shift,meta} = input - if (ctrl && alt && shift && !meta && code === 'KeyI') { - Electron.BrowserWindow.getFocusedWindow().webContents.toggleDevTools({mode:'detach'}) + const {code,alt,control,shift,meta,type} = input + if (type !== 'keyDown') { + return } - if (ctrl && alt && shift && !meta && code === 'KeyR') { + if (control && alt && shift && !meta && code === 'KeyI') { + Electron.BrowserWindow.getFocusedWindow().webContents.toggleDevTools() + } + if (control && alt && shift && !meta && code === 'KeyR') { Electron.BrowserWindow.getFocusedWindow().reload() } - let cmd_q = meta && !ctrl && !alt && !shift && code === 'KeyQ' - let ctrl_q = !meta && ctrl && !alt && !shift && code === 'KeyQ' - let alt_f4 = !meta && !ctrl && alt && !shift && code === 'F4' - let ctrl_w = !meta && ctrl && !alt && !shift && code === 'KeyW' + let cmd_q = meta && !control && !alt && !shift && code === 'KeyQ' + let ctrl_q = !meta && control && !alt && !shift && code === 'KeyQ' + let alt_f4 = !meta && !control && alt && !shift && code === 'F4' + let ctrl_w = !meta && control && !alt && !shift && code === 'KeyW' let quit_on_mac = process.platform == 'darwin' && (cmd_q || alt_f4) let quit_on_win = process.platform == 'win32' && (alt_f4 || ctrl_w) let quit_on_lin = process.platform == 'linux' && (alt_f4 || ctrl_q || ctrl_w)