@@ -394,11 +394,15 @@ const buildMenu = (opts) => {
394394 { role : 'unhide' } ,
395395 { type : 'separator' } ,
396396 ...( options . footermenu ) ,
397- {
398- label : 'Close App' ,
399- role : 'quit' ,
400- accelerator : shortcut ( 'close' )
401- }
397+ { label : 'Close app' , accelerator : shortcut ( 'quit' ) , click : ( ev ) => {
398+ console . warn ( 'Quit dialog' ) ;
399+ dialog . showMessageBox ( { message : 'Are you sure you want to quit?' , type :'question' , buttons :[ 'Yes' , 'No' ] } ) . then ( ( res ) => {
400+ if ( res . response == 0 ) {
401+ app . quit ( ) ;
402+ }
403+ } )
404+
405+ } }
402406 ]
403407 } ] : [ ] ) ,
404408 // { role: 'fileMenu' }
@@ -558,10 +562,20 @@ const buildMenu = (opts) => {
558562 windows . focused . call ( 'checkupdates' , true ) ;
559563 }
560564 } ,
561- ...( isMac ? [ { type : 'separator' } ] : [ ] )
565+ ...( isMac ? [ { type : 'separator' } ] : [
566+ { label : 'Close app' , accelerator : shortcut ( 'quit' ) , click : ( ev ) => {
567+ console . warn ( 'Quit dialog' ) ;
568+ dialog . showMessageBox ( { message : 'Are you sure you want to quit?' , type :'question' , buttons :[ 'Yes' , 'No' ] } ) . then ( ( res ) => {
569+ if ( res . response == 0 ) {
570+ app . quit ( ) ;
571+ }
572+ } )
573+
574+ } }
575+ ] )
562576 ] : [ ] ) ,
563577 //win.webContents.send('context', 'Iconize');
564- ...( isMac ? [ { role : 'close' } ] : [ { type : 'separator' } , ...( options . footermenu ) ] )
578+ ...( isMac ? [ ] : [ { type : 'separator' } , ...( options . footermenu ) ] )
565579 ]
566580 } ,
567581 // { role: 'editMenu' }
@@ -659,16 +673,8 @@ const buildMenu = (opts) => {
659673 { role : 'togglefullscreen' } ,
660674 ...( isMac ? [
661675 { type : 'separator' } ,
662- { role : 'front' } ,
663- { type : 'separator' } ,
664- { role : 'window' }
665- ] : [
666- {
667- label : 'Close Window' ,
668- role : 'close' ,
669- accelerator : shortcut ( 'close' )
670- }
671- ] )
676+ { role : 'front' }
677+ ] : [ ] )
672678 ]
673679 } ,
674680
@@ -911,7 +917,11 @@ callFakeMenu["checkupdates"] = () => {
911917}
912918
913919callFakeMenu [ "exit" ] = ( ) => {
914- app . quit ( ) ;
920+ dialog . showMessageBox ( { message : 'Are you sure you want to quit?' , type :'question' , buttons :[ 'Yes' , 'No' ] } ) . then ( ( res ) => {
921+ if ( res . response == 0 ) {
922+ app . quit ( ) ;
923+ }
924+ } )
915925}
916926
917927const devicesHID = { } ;
0 commit comments