2013-07-17 08:21:33 +00:00
|
|
|
var app = require('app');
|
|
|
|
var Menu = require('menu');
|
|
|
|
var MenuItem = require('menu-item');
|
|
|
|
var BrowserWindow = require('browser-window');
|
|
|
|
|
|
|
|
var mainWindow = null;
|
|
|
|
var menu = null;
|
|
|
|
|
|
|
|
// Quit when all windows are closed.
|
|
|
|
app.on('window-all-closed', function() {
|
2014-04-10 07:08:14 +00:00
|
|
|
app.quit();
|
2013-07-17 08:21:33 +00:00
|
|
|
});
|
|
|
|
|
2013-12-27 03:08:26 +00:00
|
|
|
app.on('ready', function() {
|
2014-05-15 07:29:53 +00:00
|
|
|
mainWindow = new BrowserWindow({
|
|
|
|
width: 800,
|
|
|
|
height: 600,
|
2014-05-22 01:09:32 +00:00
|
|
|
resizable: false,
|
2014-10-17 08:43:37 +00:00
|
|
|
'auto-hide-menu-bar': true,
|
2014-05-15 07:29:53 +00:00
|
|
|
'use-content-size': true,
|
|
|
|
});
|
2013-07-17 08:21:33 +00:00
|
|
|
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
2014-09-09 10:33:36 +00:00
|
|
|
mainWindow.focus();
|
2013-07-17 08:21:33 +00:00
|
|
|
|
2013-10-02 13:51:19 +00:00
|
|
|
if (process.platform == 'darwin') {
|
|
|
|
var template = [
|
|
|
|
{
|
|
|
|
label: 'Atom Shell',
|
|
|
|
submenu: [
|
|
|
|
{
|
|
|
|
label: 'About Atom Shell',
|
|
|
|
selector: 'orderFrontStandardAboutPanel:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'separator'
|
|
|
|
},
|
2014-09-05 05:07:05 +00:00
|
|
|
{
|
|
|
|
label: 'Services',
|
|
|
|
submenu: []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'separator'
|
|
|
|
},
|
2013-10-02 13:51:19 +00:00
|
|
|
{
|
|
|
|
label: 'Hide Atom Shell',
|
|
|
|
accelerator: 'Command+H',
|
|
|
|
selector: 'hide:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Hide Others',
|
|
|
|
accelerator: 'Command+Shift+H',
|
|
|
|
selector: 'hideOtherApplications:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Show All',
|
|
|
|
selector: 'unhideAllApplications:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'separator'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Quit',
|
|
|
|
accelerator: 'Command+Q',
|
|
|
|
click: function() { app.quit(); }
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
submenu: [
|
|
|
|
{
|
|
|
|
label: 'Undo',
|
|
|
|
accelerator: 'Command+Z',
|
|
|
|
selector: 'undo:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Redo',
|
|
|
|
accelerator: 'Shift+Command+Z',
|
|
|
|
selector: 'redo:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'separator'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Cut',
|
|
|
|
accelerator: 'Command+X',
|
|
|
|
selector: 'cut:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Copy',
|
|
|
|
accelerator: 'Command+C',
|
|
|
|
selector: 'copy:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Paste',
|
|
|
|
accelerator: 'Command+V',
|
|
|
|
selector: 'paste:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Select All',
|
|
|
|
accelerator: 'Command+A',
|
|
|
|
selector: 'selectAll:'
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'View',
|
|
|
|
submenu: [
|
|
|
|
{
|
|
|
|
label: 'Reload',
|
|
|
|
accelerator: 'Command+R',
|
2014-05-05 07:45:50 +00:00
|
|
|
click: function() { mainWindow.restart(); }
|
2013-10-02 13:51:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Enter Fullscreen',
|
2014-06-21 15:34:31 +00:00
|
|
|
click: function() { mainWindow.setFullScreen(true); }
|
2013-10-02 13:51:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Toggle DevTools',
|
|
|
|
accelerator: 'Alt+Command+I',
|
2014-05-05 07:45:50 +00:00
|
|
|
click: function() { mainWindow.toggleDevTools(); }
|
2013-10-02 13:51:19 +00:00
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Window',
|
|
|
|
submenu: [
|
|
|
|
{
|
|
|
|
label: 'Minimize',
|
|
|
|
accelerator: 'Command+M',
|
|
|
|
selector: 'performMiniaturize:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Close',
|
|
|
|
accelerator: 'Command+W',
|
|
|
|
selector: 'performClose:'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'separator'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Bring All to Front',
|
|
|
|
selector: 'arrangeInFront:'
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
];
|
2013-07-17 08:21:33 +00:00
|
|
|
|
2013-10-02 13:51:19 +00:00
|
|
|
menu = Menu.buildFromTemplate(template);
|
2013-08-06 13:08:30 +00:00
|
|
|
Menu.setApplicationMenu(menu);
|
2013-10-02 13:51:19 +00:00
|
|
|
} else {
|
|
|
|
var template = [
|
|
|
|
{
|
2014-10-17 08:43:37 +00:00
|
|
|
label: '&File',
|
2013-10-02 13:51:19 +00:00
|
|
|
submenu: [
|
|
|
|
{
|
2014-10-16 12:59:01 +00:00
|
|
|
label: '&Open',
|
2014-03-14 13:45:53 +00:00
|
|
|
accelerator: 'Ctrl+O',
|
2013-10-02 13:51:19 +00:00
|
|
|
},
|
|
|
|
{
|
2014-10-16 12:59:01 +00:00
|
|
|
label: '&Close',
|
2014-03-14 13:45:53 +00:00
|
|
|
accelerator: 'Ctrl+W',
|
2013-10-02 13:51:19 +00:00
|
|
|
click: function() { mainWindow.close(); }
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2014-10-17 08:43:37 +00:00
|
|
|
label: '&View',
|
2013-10-02 13:51:19 +00:00
|
|
|
submenu: [
|
|
|
|
{
|
2014-10-16 12:59:01 +00:00
|
|
|
label: '&Reload',
|
2014-03-14 13:45:53 +00:00
|
|
|
accelerator: 'Ctrl+R',
|
2013-10-02 13:51:19 +00:00
|
|
|
click: function() { mainWindow.restart(); }
|
|
|
|
},
|
|
|
|
{
|
2014-10-16 12:59:01 +00:00
|
|
|
label: '&Enter Fullscreen',
|
2014-03-14 13:45:53 +00:00
|
|
|
click: function() { mainWindow.setFullScreen(true); }
|
2013-10-02 13:51:19 +00:00
|
|
|
},
|
|
|
|
{
|
2014-10-16 12:59:01 +00:00
|
|
|
label: '&Toggle DevTools',
|
2014-03-14 13:45:53 +00:00
|
|
|
accelerator: 'Alt+Ctrl+I',
|
2013-10-02 13:51:19 +00:00
|
|
|
click: function() { mainWindow.toggleDevTools(); }
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
menu = Menu.buildFromTemplate(template);
|
2013-10-02 13:24:21 +00:00
|
|
|
mainWindow.setMenu(menu);
|
2013-10-02 13:51:19 +00:00
|
|
|
}
|
2013-07-17 08:21:33 +00:00
|
|
|
});
|