Fix electron shortcuts to enable toggling the developer tools and quitting the application. (https://github.com/enso-org/ide/pull/1173)

Original commit: 8f2a1a23fd
This commit is contained in:
Michael Mauderer 2021-02-05 21:51:41 +00:00 committed by GitHub
parent 210b40a49f
commit 59d4f566a6
2 changed files with 16 additions and 10 deletions

View File

@ -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.
<br/>
<br/>
# 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

View File

@ -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)