diff --git a/main.tsx b/main.tsx index d4935a9..bd4bb70 100644 --- a/main.tsx +++ b/main.tsx @@ -7,7 +7,6 @@ let createWindow = function () { mainWindow = new BrowserWindow({ width: 1280, height: 800, - transparent: true, webPreferences: { // nodeIntegration: true } diff --git a/src/AppMenu.ts b/src/AppMenu.ts index 91148bb..717e50c 100644 --- a/src/AppMenu.ts +++ b/src/AppMenu.ts @@ -1,10 +1,56 @@ import { BrowserView, Menu, app, shell, dialog, BrowserWindow, MenuItem } from 'electron'; -export function initMenu () { +export function initMenu() { const menu: Menu = new Menu(); - const menuItem: MenuItem = new MenuItem({ - label: "test", + const fileMenu: MenuItem = new MenuItem({ + label: "行为树", + submenu: [ + { label: "打开文件" }, + { label: "打开目录" }, + { type: 'separator'}, + { + label: "最近打开", + submenu: [] + }, + { + label: "最近目录", + submenu: [ + {label: "master"}, + {label: "分支0908"}, + ] + }, + { type: 'separator'}, + { + label: "关闭", + click: () => { + app.quit(); + } + } + ] }); - menu.append(menuItem); + + const toolsMenu: MenuItem = new MenuItem({ + label: "开发工具", + submenu: [ + { + label: "重载", + accelerator: "ctrl + r", + click: (_, browserWindow) => { + browserWindow.reload(); + } + }, + { + label: "打开控制台", + accelerator: "ctrl + shift + i", + click: (_, browserWindow) => { + browserWindow.webContents.toggleDevTools(); + } + } + ] + }); + + menu.append(fileMenu); + menu.append(toolsMenu); + Menu.setApplicationMenu(menu); }