Is there a way to append menu items to the debug menu?
mdrx-io opened this issue · comments
Mike Lewis commented
For example, I have a few menu items in production that I would like to carry over to the development builds, like "About" which holds the version number.
Mike Lewis commented
Okay, played around with the standard API and it was actually pretty easy. For anyone else who was wondering:
import electronDebug from 'electron-debug'
electronDebug({ enabled: true, showDevTools: true })
const aboutMenuItem = new MenuItem({
label: 'About',
click: function (item, focusedWindow) {
if (focusedWindow) {
const options = {
type: 'info',
title: 'About',
buttons: ['Ok'],
message: `Version 0.1.0`
}
dialog.showMessageBox(focusedWindow, options, () => {})
}
}
})
const menu = Menu.getApplicationMenu()
// Stick the About submenu on the very end of Help.
menu.items[menu.items.length - 1].submenu.append(aboutMenuItem)