How to use the menu.buildFromTemplate function in menu

To help you get started, we’ve selected a few menu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dataproofer / Dataproofer / electron / app.js View on Github external
app.on("ready", function() {
  // Create the browser window.
  mainWindow = new BrowserWindow({
    width: 1500,
    height: 900,
    "minWidth": 500,
    "minHeight": 200,
    "acceptFirstMouse": true,
    // 'titleBarStyle': 'hidden',
    icon: __dirname + "/icons/dataproofer-logo-large.png"
  });

  var menu = defaultMenu();
  Menu.setApplicationMenu(Menu.buildFromTemplate(menu));

  // and load the index.html of the app.
  mainWindow.loadURL(`file://${__dirname}/index.html`);


  // Emitted when the window is closed.
  mainWindow.on("closed", function() {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });

  var webContents = mainWindow.webContents;

  if(DEVELOPMENT)
github SebastianSzturo / basecamp-desktop / app / app.js View on Github external
app.on('ready', function() {

  // Set menu
  var mainMenu = Menu.buildFromTemplate(menuTemplate);
  Menu.setApplicationMenu(mainMenu);

  // Create the browser window.
  mainWindow = new BrowserWindow({
    width: 900, height: 800,
    "type": "toolbar",
    "title": "Basecamp 3",
    "icon": "./assets/shared/icon.png",
    "node-integration": false
  });

  // Load basecamp.
  mainWindow.loadUrl('https://launchpad.37signals.com/', {
    userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.52 Safari/537.36'
  });
github simondavies / electron-vuejs-starter / app / App.js View on Github external
*
 * @author Simon Davies
 */

var app = require('app');
var browserWindow = require('browser-window');
var ipc = require('ipc');
var Menu    = require('menu');

//-- reports any crashes to the server
require('crash-reporter').start();


//-- set up the main app menu
var menu_template = require('./inc/app-menu.js');
var main_menu = Menu.buildFromTemplate(menu_template);

//-- set up the main menu items


//-- create a global var for all the windows
var appWindows = {
  main : null
}

/**
 * quit the app when all windows are closed
 */
 app.on('window-all-closed', function() {
   if (process.platform != 'darwin') { app.quit();}
  });
github cyrilis / Douban-FM-Express / index.js View on Github external
app.on('ready', function() {

  menu = Menu.buildFromTemplate(template);

  Menu.setApplicationMenu(menu);


  mainWindow = new BrowserWindow({width: 450, height: 550, frame: false, transparent: true});

  mainWindow.loadUrl('file://' + __dirname + '/index.html');

  mainWindow.on('closed', function() {
    mainWindow = null;
  });
});
github muan / scribble-electron / index.js View on Github external
mb.on('ready', function () {
  var menu = Menu.buildFromTemplate(template)
  Menu.setApplicationMenu(menu)
})
github zeebe-io / zeebe-modeler / app / lib / platform / Menus.js View on Github external
Menus.prototype.attachMenus = function(template, notation) {
  this.menu = Menu.buildFromTemplate(template);

  this.setNotation('edit', notation);

  Menu.setApplicationMenu(this.menu);
};
github md-viewer / md-viewer / app / main / menus.js View on Github external
createMenu() {
    const template = utils.clone(MenuData.template)
    const handler  = new MenuData.HandlerClass(this)
    setMenuHandlers(template, handler)

    this.menu = Menu.buildFromTemplate(template)
  }
github PolarisChen / Piece / main.js View on Github external
const app = require('app');
const BrowserWindow = require('browser-window');
const path = require('path');
const Tray = require('tray');
const Menu = require('menu');

const globalShortcut = require('global-shortcut');

const {ipcMain} = require('electron');
const config = require('./config');

require('crash-reporter').start();

let appIcon = null;
let mainWindow = null;
let contextMenu = Menu.buildFromTemplate([
	{
		label: 'Float',
		type: 'checkbox',
		checked: true,
    accelerator: 'Shift+Alt+F',
		click: toggleFloat
	},
	{
		label: 'Show',
		type: 'checkbox',
		checked: true,
    accelerator: 'Shift+Alt+S',
		click: toggleShow
	},
	{
		type: 'separator'

menu

A terminal menu for your node.

MIT
Latest version published 9 years ago

Package Health Score

42 / 100
Full package analysis