From 48f57376d3bb9c2008460c336c2f8c476c75355f Mon Sep 17 00:00:00 2001 From: Dick Choi Date: Wed, 16 Dec 2015 09:15:52 +0900 Subject: [PATCH] fix menu-template --- atom-lib/menu-template.js | 301 ++++++++++++++++++++------------------ 1 file changed, 155 insertions(+), 146 deletions(-) diff --git a/atom-lib/menu-template.js b/atom-lib/menu-template.js index 7f69fab9..77245289 100644 --- a/atom-lib/menu-template.js +++ b/atom-lib/menu-template.js @@ -2,150 +2,159 @@ const electron = require('electron') const BrowserWindow = electron.BrowserWindow const shell = electron.shell -module.exports = [ - { - label: 'Electron', - submenu: [ - { - label: 'About Boost', - selector: 'orderFrontStandardAboutPanel:' - }, - { - type: 'separator' - }, - { - label: 'Services', - submenu: [] - }, - { - type: 'separator' - }, - { - label: 'Hide Boost', - 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', - selector: 'terminate:' +var boost = { + label: 'Boost', + submenu: [ + { + label: 'About Boost', + selector: 'orderFrontStandardAboutPanel:' + }, + { + type: 'separator' + }, + { + label: 'Services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: 'Hide Boost', + 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', + selector: 'terminate:' + } + ] +} + +var edit = { + 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:' + } + ] +} + +var view = { + label: 'View', + submenu: [ + { + label: 'Reload', + accelerator: (function () { + if (process.platform === 'darwin') return 'Command+R' + else return 'Ctrl+R' + })(), + click: function () { + BrowserWindow.getFocusedWindow().reload() } - ] - }, - { - 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', - click: function () { - BrowserWindow.getFocusedWindow().reload() - } - }, - { - label: 'Toggle Developer Tools', - accelerator: (function () { - if (process.platform === 'darwin') return 'Alt+Command+I' - else return 'Ctrl+Shift+I' - })(), - click: function (item, focusedWindow) { - if (focusedWindow) BrowserWindow.getFocusedWindow().toggleDevTools() - } - } - ] - }, - { - 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:' - } - ] - }, - { - label: 'Help', - role: 'help', - submenu: [ - { - label: 'Boost official site', - click: function () { shell.openExternal('https://b00st.io/') } - }, - { - label: 'Tutorial page', - click: function () { shell.openExternal('https://b00st.io/tutorial.html') } - }, - { - label: 'Discussions', - click: function () { shell.openExternal('https://github.com/BoostIO/boost-app-discussions/issues') } - }, - { - label: 'Changelog', - click: function () { shell.openExternal('https://github.com/BoostIO/boost-releases/blob/master/changelog.md') } - } - ] - } -] + }, + // { + // label: 'Toggle Developer Tools', + // accelerator: (function () { + // if (process.platform === 'darwin') return 'Alt+Command+I' + // else return 'Ctrl+Shift+I' + // })(), + // click: function (item, focusedWindow) { + // if (focusedWindow) BrowserWindow.getFocusedWindow().toggleDevTools() + // } + // } + ] +} + +var window = { + 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:' + } + ] +} + +var help = { + label: 'Help', + role: 'help', + submenu: [ + { + label: 'Boost official site', + click: function () { shell.openExternal('https://b00st.io/') } + }, + { + label: 'Tutorial page', + click: function () { shell.openExternal('https://b00st.io/tutorial.html') } + }, + { + label: 'Discussions', + click: function () { shell.openExternal('https://github.com/BoostIO/boost-app-discussions/issues') } + }, + { + label: 'Changelog', + click: function () { shell.openExternal('https://github.com/BoostIO/boost-releases/blob/master/changelog.md') } + } + ] +} + +module.exports = process.platform === 'darwin' + ? [boost, edit, view, window, help] + : [view, help]