mirror of
https://github.com/pierre42100/ComunicDesktop
synced 2024-11-23 12:39:22 +00:00
Begin to create custom application menu
This commit is contained in:
parent
24643f0867
commit
33b8e4e2b6
43
ApplicationMenu.js
Normal file
43
ApplicationMenu.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/**
|
||||||
|
* Application menu
|
||||||
|
*
|
||||||
|
* @author Comunic Authors
|
||||||
|
*/
|
||||||
|
|
||||||
|
const {app, Menu} = require('electron');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get application menu
|
||||||
|
*
|
||||||
|
* @param {BrowserWindow} window
|
||||||
|
* @return {Menu} Application menu
|
||||||
|
*/
|
||||||
|
module.exports.Get = function(window){
|
||||||
|
|
||||||
|
return Menu.buildFromTemplate([
|
||||||
|
{
|
||||||
|
label: "File",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Quit",
|
||||||
|
click: () => {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: "Advanced",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Toggle developer tools",
|
||||||
|
click: () => {
|
||||||
|
window.webContents.toggleDevTools();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
}
|
@ -6,9 +6,10 @@
|
|||||||
|
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const BrowserWindow = electron.BrowserWindow;
|
const BrowserWindow = electron.BrowserWindow;
|
||||||
const {Tray} = require('electron');
|
const {Menu, Tray} = require('electron');
|
||||||
const Config = require("./Config");
|
const Config = require("./Config");
|
||||||
const TrayMenu = require("./TrayMenu");
|
const TrayMenu = require("./TrayMenu");
|
||||||
|
const ApplicationMenu = require("./ApplicationMenu");
|
||||||
|
|
||||||
|
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
@ -48,6 +49,9 @@ exports.show = function(){
|
|||||||
|
|
||||||
console.log("Started successfully");
|
console.log("Started successfully");
|
||||||
|
|
||||||
|
//Set application menu
|
||||||
|
Menu.setApplicationMenu(ApplicationMenu.Get(mainWindow));
|
||||||
|
|
||||||
mainWindow.once('ready-to-show', () => {
|
mainWindow.once('ready-to-show', () => {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user