File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,12 @@ module.exports = function registerMenu(win, state = {}) {
65
65
enabled : state . view === 'editor' ,
66
66
click : ( ) => win . webContents . send ( 'shortcut-cmd' , shortcuts . global . SAVE )
67
67
} ,
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' }
69
74
]
70
75
} ,
71
76
{
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const { globalShortcut } = require('electron')
2
2
let shortcutsActive = false
3
3
const shortcuts = {
4
4
global : {
5
+ CLOSE : 'CommandOrControl+W' ,
5
6
CONNECT : 'CommandOrControl+Shift+C' ,
6
7
DISCONNECT : 'CommandOrControl+Shift+D' ,
7
8
RUN : 'CommandOrControl+R' ,
@@ -16,6 +17,7 @@ const shortcuts = {
16
17
FILES_VIEW : 'CommandOrControl+Alt+2' ,
17
18
} ,
18
19
menu : {
20
+ CLOSE : 'CmdOrCtrl+W' ,
19
21
CONNECT : 'CmdOrCtrl+Shift+C' ,
20
22
DISCONNECT : 'CmdOrCtrl+Shift+D' ,
21
23
RUN : 'CmdOrCtrl+R' ,
Original file line number Diff line number Diff line change @@ -1440,7 +1440,9 @@ async function store(state, emitter) {
1440
1440
1441
1441
win . onKeyboardShortcut ( ( key ) => {
1442
1442
if ( state . shortcutsDisabled ) return
1443
-
1443
+ if ( key === shortcuts . CLOSE ) {
1444
+ emitter . emit ( 'close-tab' , state . editingFile )
1445
+ }
1444
1446
if ( key === shortcuts . CONNECT ) {
1445
1447
emitter . emit ( 'connect' )
1446
1448
}
You can’t perform that action at this time.
0 commit comments