From 5fb3ed2b7a0d6c07d354959d74bdfaf11d1d8e0f Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Sat, 1 Oct 2022 21:59:51 +0200 Subject: [PATCH] added custom main menu --- src/MainMenu.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/MainMenu.js diff --git a/src/MainMenu.js b/src/MainMenu.js new file mode 100644 index 0000000..ba37ac9 --- /dev/null +++ b/src/MainMenu.js @@ -0,0 +1,27 @@ +"use strict"; + +const {Menu} = require("electron"); + +class MainMenu { + constructor(app) { + this.app = app; + this.menu = null; + this.buildItems(); + Menu.setApplicationMenu(this.menu); + } + + buildItems() { + const template = [ + ...(process.platform === "darwin" ? [{ + role : "appMenu" + }] : []), + { + role : "windowMenu" + } + ]; + + this.menu = Menu.buildFromTemplate(template); + } +} + +module.exports = MainMenu; \ No newline at end of file