1+ const { app, dialog} = require ( 'electron' ) ;
2+
13const { getKeymaps} = require ( '../config' ) ;
4+ const { icon} = require ( '../config/paths' ) ;
25
36// menus
47const viewMenu = require ( './menus/view' ) ;
@@ -9,16 +12,32 @@ const windowMenu = require('./menus/window');
912const helpMenu = require ( './menus/help' ) ;
1013const darwinMenu = require ( './menus/darwin' ) ;
1114
12- module . exports = ( createWindow , updatePlugins ) => {
15+ const appName = app . getName ( ) ;
16+ const appVersion = app . getVersion ( ) ;
17+
18+ module . exports = ( createWindow , updatePlugins , getLoadedPluginVersions ) => {
1319 const commands = getKeymaps ( ) . commands ;
20+ const showAbout = ( ) => {
21+ const loadedPlugins = getLoadedPluginVersions ( ) ;
22+ const pluginList = loadedPlugins . length === 0 ?
23+ 'none' :
24+ loadedPlugins . map ( plugin => `\n ${ plugin . name } (${ plugin . version } )` ) ;
25+ dialog . showMessageBox ( {
26+ title : `About ${ appName } ` ,
27+ message : `${ appName } ${ appVersion } ` ,
28+ detail : `Plugins: ${ pluginList } \n\nCreated by Guillermo Rauch\nCopyright © 2017 Zeit, Inc.` ,
29+ buttons : [ ] ,
30+ icon
31+ } ) ;
32+ } ;
1433 const menu = [
15- ...( process . platform === 'darwin' ? [ darwinMenu ( commands ) ] : [ ] ) ,
34+ ...( process . platform === 'darwin' ? [ darwinMenu ( commands , showAbout ) ] : [ ] ) ,
1635 shellMenu ( commands , createWindow ) ,
1736 editMenu ( commands ) ,
1837 viewMenu ( commands ) ,
1938 pluginsMenu ( commands , updatePlugins ) ,
2039 windowMenu ( commands ) ,
21- helpMenu ( commands )
40+ helpMenu ( commands , showAbout )
2241 ] ;
2342
2443 return menu ;
0 commit comments