How to use the nw.gui.Menu function in nw

To help you get started, we’ve selected a few nw 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 ChrisTerBeke / devkit-core / www / js / devkit.devkitCtrl.js View on Github external
label: 'Save All',
		click: function() {
			$rootScope.$emit('editor.saveall');
		},
		key: 's',
		modifiers: 'cmd+shift'
	}),7);
	
	win.menu.insert(new gui.MenuItem({
		label: 'File',
		submenu: file
	}), 1);
			
			
	// project menu
	var project = new gui.Menu();
	
	project.insert(new gui.MenuItem({
		label: 'Run',
		click: function(){
			$rootScope.$emit('homey.run');
		},
		key: 'r',
		modifiers: 'cmd'
	}), 0);
	
	project.insert(new gui.MenuItem({
		label: 'Run and Break',
		click: function(){
			$rootScope.$emit('homey.runbrk');
		},
		key: 'r',
github kalabox / kalabox / src / modules / initialize / initialize.js View on Github external
function($scope, $state, kbox, globalConfig, sites) {

    // Grab NW things so we can build a menu
    var gui = require('nw.gui');
    var mb = new gui.Menu({type: 'menubar'});

    // Add default menu options for osx
    if (process.platform === 'darwin') {
      mb.createMacBuiltin('Kalabox', {hideEdit: false, hideWindow: true});
      // TODO: move this outside the conditional once we have support for WIN/LINUX menus as well
      gui.Window.get().menu = mb;
    }

    // Take us to the Dashboard.
    kbox.then(function(kbox) {

      // Check if we are up already
      return kbox.engine.isUp()

      // Bring up the engine up if needed
      .then(function(isUp) {
github szwacz / nw-boilerplate / app / app.html View on Github external
(function () {
            var gui = require('nw.gui');
            var win = gui.Window.get();

            // Create default menu items for OSX
            if (process.platform === 'darwin') {
                var mb = new gui.Menu({ type: "menubar" });
                mb.createMacBuiltin(gui.App.manifest.productName);
                win.menu = mb;
            }
        }());
github capablemonkey / sleep / app / js / index.js View on Github external
function initTray() {
	// TODO: maybe have a giant display for the time that spans 5 menu items; make the time more prominent

	// add tray icon to statusbar:
	tray = new gui.Tray({ icon: 'assets/icon2.png'});

	/*
	 *	create the main tray menu and its items
	 */

	trayMenu = new gui.Menu();
	trayMenuItems.lastSlept = new gui.MenuItem({ type: 'normal', label: 'ugh', enabled: false });
	trayMenuItems.lastWoke = new gui.MenuItem({ type: 'normal', label: 'ugh', enabled: false });
	trayMenuItems.duration = new gui.MenuItem({ type: 'normal', label: 'ugh', enabled: false });
	trayMenuItems.sep1 = new gui.MenuItem({type: 'separator'});
	trayMenuItems.reasonLabel = new gui.MenuItem({type: 'normal', label: 'reason for sleep:', enabled: false});
	trayMenuItems.reason = new gui.MenuItem({ type: 'normal', label: 'ugh', enabled: false });
	trayMenuItems.sep2 = new gui.MenuItem({type: 'separator'});
	trayMenuItems.startup = new gui.MenuItem({type: 'checkbox', label: 'run on login?', checked: false});
	trayMenuItems.about = new gui.MenuItem({type: 'normal', label: 'about'});
	trayMenuItems.quit = new gui.MenuItem({ type: 'normal', label: 'quit', enabled: true });

	// TODO: make a button to refresh 
	
	/*
	 *	Logic + Event handling for MenuItems
	 */
github samatt / nsheyy_gui / public / app.js View on Github external
function setupMenu() {
  var nativeMenuBar = new nw.Menu({ type: "menubar" });
  nativeMenuBar.createMacBuiltin("N.S.Heyyy", {hideEdit: true, hideWindow: true});
  win.menu = nativeMenuBar;

  var fileMenu = new nw.Menu();
  fileMenu.append(new nw.MenuItem({ label: 'Authenticate', click: function(){
    document.querySelector('#auth').style.display = 'block';
  }}));

  win.menu.append(new nw.MenuItem({label: 'File', submenu: fileMenu}));

  var snifferMenu = new nw.Menu();
  var interfaces = [];

  var addMenuItem = function(l,snifferMenu){
    snifferMenu.append(new nw.MenuItem({ label: l, click: function(){
      console.log("Clicked");
      if (running) {
        stopSniff();
      } else {
        var filename;
github chovy / bmr / app / js / inbox.js View on Github external
ui.$pg.find("table").on('contextmenu.inbox', 'tr.msg .message', function (e) {
            e.preventDefault();

            var isSentMessage = false
                , $row = $(e.currentTarget).parents('tr.msg')
                , id = $row.attr('data-msgid'); //msg.msgid

            var gui = require('nw.gui')
                , menu = new gui.Menu();

            var searchItem = new gui.MenuItem({
                label: 'Search web...'
                , click: function(e){
                    var text = window.getSelection().toString()
                        , q = encodeURIComponent(text.replace(/&/g, "&"));

                    //var url = 'https://encrypted.google.com/#q='+q;
                    var url = 'https://ixquick.com/do/search?q='+q;

                    ui.win(url);
                }
            });

            var quoteItem = new gui.MenuItem({
                label: 'Quote text in reply'
github berbaquero / Reeddit-app / js / reeddit.js View on Github external
click: function () {
			var title = M.Posts.shareTitle,
				url = M.Posts.shareURL;
			openURL("mailto:?subject=" + title + "&body=" + url + "%0A%0a%0A%0aShared via @ReedditApp.");
		}
	}));

	shareMenu.append(new gui.MenuItem({
		label: 'Copy Link',
		click: function () {
			sharing.clipboard(M.Posts.shareURL);
			V.Actions.showNotification("Copied to Clipboard");
		}
	}));

	var subsMenu = new gui.Menu();
	subsMenu.append(new gui.MenuItem({
		label: "Add Subreddit from List",
		click: V.Actions.loadForAdding
	}));

	subsMenu.append(new gui.MenuItem({
		label: "Add Subreddit Manually",
		click: V.Subreddits.showManualInput
	}));

	subsMenu.append(new gui.MenuItem({
		type: 'separator'
	}));

	subsMenu.append(new gui.MenuItem({
		label: 'Create Channel',
github matthewn4444 / Lightpack-Filter-and-API / directshow / Lightpack-filter-gui / app / src / js / script.js View on Github external
function initTray() {
    tray = new gui.Tray({ icon: "/app/src/images/icon.png" });
    tray.tooltip = "Lightpack Filter";

    var trayMenu = new gui.Menu();
    trayMenu.append(new gui.MenuItem({ label: "Edit Settings", click: showWindow }));
    trayMenu.append(new gui.MenuItem({ type: "separator" }));
    trayMenu.append(new gui.MenuItem({ label: "Close", click: close }));
    tray.menu = trayMenu;
    tray.on("click", showWindow);
}
win.on("minimize", function() {
github nihgwu / Nevermore / js / menu.js View on Github external
var gui = require('nw.gui');

tray = new gui.Tray({
  icon: 'img/menu_icon.png'
});
menu = new gui.Menu();
tray.on('click', function() {
  return gui.Window.get().show();
});
show = new gui.MenuItem({
  type: 'normal',
  label: '显示',
  click: function() {
    return gui.Window.get().show();
  }
});
hide = new gui.MenuItem({
  type: 'normal',
  label: '隐藏',
  click: function() {
    return gui.Window.get().hide();
  }
github urlysses / wrong / Resources / app.nw / src / app.js View on Github external
(function (global) {
    "use strict";

    var gui = require("nw.gui"),
        fs = require("fs"),
        win = gui.Window.get(),
        menu = new gui.Menu(),
        clip = gui.Clipboard.get(),
        TM,
        Files,
        History,
        View,
        Keys,
        Control,
        Settings,
        tm,
        tabDragging,
        saveFile,
        newFile,
        openFileDialog,
        readFile,
        closeWindow,
        closeTab,