Skip to content

Commit 5b81693

Browse files
committed
Added META+W (close tab) and META+Q (quit).
Signed-off-by: ubi de feo <[email protected]>
1 parent be5f149 commit 5b81693

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

backend/menu.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ module.exports = function registerMenu(win, state = {}) {
6565
enabled: state.view === 'editor',
6666
click: () => win.webContents.send('shortcut-cmd', shortcuts.global.SAVE)
6767
},
68-
isMac ? { role: 'close' } : { role: 'quit' }
68+
{ label: 'Close tab',
69+
accelerator: 'CmdOrCtrl+W',
70+
enabled: state.view === 'editor',
71+
click: () => win.webContents.send('shortcut-cmd', shortcuts.global.CLOSE)
72+
},
73+
{ role: 'quit' }
6974
]
7075
},
7176
{

backend/shortcuts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { globalShortcut } = require('electron')
22
let shortcutsActive = false
33
const shortcuts = {
44
global: {
5+
CLOSE: 'CommandOrControl+W',
56
CONNECT: 'CommandOrControl+Shift+C',
67
DISCONNECT: 'CommandOrControl+Shift+D',
78
RUN: 'CommandOrControl+R',
@@ -16,6 +17,7 @@ const shortcuts = {
1617
FILES_VIEW: 'CommandOrControl+Alt+2',
1718
},
1819
menu: {
20+
CLOSE: 'CmdOrCtrl+W',
1921
CONNECT: 'CmdOrCtrl+Shift+C',
2022
DISCONNECT: 'CmdOrCtrl+Shift+D',
2123
RUN: 'CmdOrCtrl+R',

ui/arduino/store.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,9 @@ async function store(state, emitter) {
14401440

14411441
win.onKeyboardShortcut((key) => {
14421442
if (state.shortcutsDisabled) return
1443-
1443+
if (key === shortcuts.CLOSE) {
1444+
emitter.emit('close-tab', state.editingFile)
1445+
}
14441446
if (key === shortcuts.CONNECT) {
14451447
emitter.emit('connect')
14461448
}

0 commit comments

Comments
 (0)