| 60 | } |
| 61 | |
| 62 | async function createMenu() { |
| 63 | await i18n.loadNamespaces('applicationMenu') |
| 64 | |
| 65 | const template: MenuItemConstructorOptions[] = [ |
| 66 | { |
| 67 | label: 'Rocketredis', |
| 68 | submenu: [ |
| 69 | { |
| 70 | label: i18n.t('applicationMenu:newConnection'), |
| 71 | accelerator: 'CmdOrCtrl+N', |
| 72 | click: () => { |
| 73 | mainWindow?.webContents.send('newConnection') |
| 74 | } |
| 75 | }, |
| 76 | { |
| 77 | type: 'separator' |
| 78 | }, |
| 79 | { |
| 80 | label: i18n.t('applicationMenu:exit'), |
| 81 | role: 'quit', |
| 82 | accelerator: 'CmdOrCtrl+Q' |
| 83 | } |
| 84 | ] |
| 85 | }, |
| 86 | { |
| 87 | label: 'View', |
| 88 | submenu: [ |
| 89 | { role: 'reload' }, |
| 90 | { role: 'forceReload' }, |
| 91 | { role: 'toggleDevTools' }, |
| 92 | { type: 'separator' }, |
| 93 | { role: 'resetZoom' }, |
| 94 | { role: 'zoomIn' }, |
| 95 | { role: 'zoomOut' }, |
| 96 | { type: 'separator' }, |
| 97 | { role: 'togglefullscreen' } |
| 98 | ] |
| 99 | }, |
| 100 | { |
| 101 | role: 'help', |
| 102 | submenu: [ |
| 103 | { |
| 104 | label: 'Learn More', |
| 105 | click: () => { |
| 106 | shell.openExternal('https://github.com/diego3g/rocketredis/') |
| 107 | } |
| 108 | } |
| 109 | ] |
| 110 | } |
| 111 | ] |
| 112 | |
| 113 | const menu = Menu.buildFromTemplate(template) |
| 114 | Menu.setApplicationMenu(menu) |
| 115 | } |
| 116 | |
| 117 | app.on('ready', () => { |
| 118 | createWindow() |