File tree 3 files changed +18
-5
lines changed
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -168,8 +168,8 @@ app.on("activate", () => {
168
168
} ) ;
169
169
170
170
app . on ( "ready" , ( ) => {
171
- setApplicationMenu ( ) ;
172
171
mainWindow = createMainWindow ( ) ;
172
+ setApplicationMenu ( mainWindow ) ;
173
173
setUpTray ( app , mainWindow ) ;
174
174
175
175
// Autostart at login
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const {
13
13
startAtLogin,
14
14
} = require ( "./store" ) ;
15
15
16
- const mainMenuTemplate = [
16
+ const mainMenuTemplate = ( win ) => [
17
17
{
18
18
label : "Plugins" ,
19
19
submenu : getAllPlugins ( ) . map ( ( plugin ) => {
@@ -79,13 +79,26 @@ const mainMenuTemplate = [
79
79
} ,
80
80
] ,
81
81
} ,
82
+ {
83
+ label : "Toggle DevTools" ,
84
+ // Cannot use "toggleDevTools" role in MacOS
85
+ click : ( ) => {
86
+ const { webContents } = win ;
87
+ if ( webContents . isDevToolsOpened ( ) ) {
88
+ webContents . closeDevTools ( ) ;
89
+ } else {
90
+ const devToolsOptions = { } ;
91
+ webContents . openDevTools ( devToolsOptions ) ;
92
+ }
93
+ } ,
94
+ } ,
82
95
] ,
83
96
} ,
84
97
] ;
85
98
86
99
module . exports . mainMenuTemplate = mainMenuTemplate ;
87
- module . exports . setApplicationMenu = ( ) => {
88
- const menuTemplate = [ ...mainMenuTemplate ] ;
100
+ module . exports . setApplicationMenu = ( win ) => {
101
+ const menuTemplate = [ ...mainMenuTemplate ( win ) ] ;
89
102
if ( process . platform === "darwin" ) {
90
103
const name = app . name ;
91
104
menuTemplate . unshift ( {
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ module.exports.setUpTray = (app, win) => {
61
61
win . show ( ) ;
62
62
} ,
63
63
} ,
64
- ...mainMenuTemplate ,
64
+ ...mainMenuTemplate ( win ) ,
65
65
{
66
66
label : "Quit" ,
67
67
click : ( ) => {
You can’t perform that action at this time.
0 commit comments