Example #1
0
app.on('ready', () => {
    const mainWindow = new BrowserWindow({
        width: 700,
        height: 420,
        resizable: false,
        icon: path.join(__dirname, '../images/area51-icon.png'),
        title: 'Project Dreamland Launcher',
        center: true,
        'auto-hide-menu-bar': true,
        frame: true,
        show: args.dev ? true : false,
    })


    if (args.dev) {
        mainWindow.toggleDevTools()
        mainWindow.focus()
        console.info('Dev Mode Active: Developer Tools Enabled.')
    }

    mainWindow.loadURL(path.normalize('file://' + path.join(__dirname, '../index.html')))
    mainWindow.webContents.on('new-window', event => event.preventDefault())

    mainWindow.webContents.on('will-navigate', (event, url) => {
        if (!url.includes('build/index.html'))
            event.preventDefault()
    })

    mainWindow.webContents.on('did-finish-load', () => {
        mainWindow.show()
        mainWindow.focus()
    })

    mainWindow.on('close', app.quit)
});
Example #2
0
app.on('ready', function() {
    // This method will be called when atom-shell has done everything
    // initialization and ready for creating browser windows.

    // Create the browser window (fullscreen). {
        var Screen = require('screen'),
            workAreaSize = Screen.getPrimaryDisplay().workAreaSize;
        mainWindow = new BrowserWindow({
            width: workAreaSize.width,
            height: workAreaSize.height,
        });
    // }

    // and load the index.html of the app. {
        mainWindow.loadUrl('file://' + __dirname + '/index.html');
    // }
    // mainWindow focus {
        mainWindow.focus();
    // }

    // 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;
        });
    // }
});
Example #3
0
  ipc.on('connect', function(e, config) {

    if(config.type == 'upload') {

      var options = {
        title: 'Select a file to upload',
        properties: [ 'openFile' ]
      };

      config.file_upload = dialog.showOpenDialog(options);

      if(! config.file_upload) {
        main.webContents.send('reset', false);
        return main.webContents.send('status', 'Nothing selected to upload.');
      }

      config.file_upload = config.file_upload.toString();

    }

    terminal.show();
    terminal.focus();

    if(config.grayscale)
      terminal.webContents.send('grayscale');

    main.setSize(300, 380);

    main.webContents.send('working', 'Connecting');

    ssh_connect(config);

  });
Example #4
0
app.on('ready', function() {
  win = new Window({
    width: 800,
    height: 600
  });

  win.loadUrl('file://' + __dirname + '/index.html');
  win.focus();
});
Example #5
0
 var showHide = function(){
     var isVisible = mainWindow.isVisible();
     if(isVisible){
         mainWindow.hide();
     }else{
         mainWindow.show();
         mainWindow.focus();
     }
 };
Example #6
0
 .on('ready', function()
 {
   mainWindow = new BrowserWindow(
     { width: 500, height: 240, show: true,
       frame: false, resizable: false });
   mainWindow //.loadUrl('https://mail.google.com/');
   .loadUrl('http://localhost:3333/index.html')
   mainWindow.focus();;
 });
Example #7
0
app.on("ready", function() {
  mainWindow = new BrowserWindow({
    width: 1000,
    height: 670,
    icon: __dirname + "/icons/128.png"
  });
  mainWindow.loadURL("file://" + __dirname + "/index.html");
  mainWindow.focus();
});
Example #8
0
    finder.start(function(err, ip) {

      if(!ip) {
        return main.webContents.send('reset', true);
      }

      main.webContents.send('found', ip);
      main.setSize(500, 550);
      main.focus();
      main.center();

    });
Example #9
0
app.on('ready', function() {
    mainWindow = new BrowserWindow({
        // frame: false,
        'auto-hide-menu-bar': true,
        'use-content-size': true,
        height: 768,
        width: 1260
    });

    mainWindow.loadUrl('file://' + __dirname + '/app/index.html');
    mainWindow.focus();
});
Example #10
0
app.on("ready",function(argument) {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 500,
    resizable: false,
    'auto-hide-menu-bar': false,
    'use-content-size': true,
  });

  menu = Menu.buildFromTemplate(template);
  mainWindow.setMenu(menu);
  mainWindow.loadUrl('file://' + __dirname + '/index.html');
  mainWindow.focus();

});
Example #11
0
app.on('ready', function() {
    mainWindow = new BrowserWindow({
        width: 800,
        height: 600
    });
    
    mainWindow.loadUrl('file://' + __dirname + '/index.html');
    mainWindow.focus();
    //mainWindow.openDevTools();
    
    globalShortcut.register("s", function() {
        //alert("ctrl + s gedrückt");
        return false;
    });
});
Example #12
0
function createWindow() {
  var browserWindowOptions = packageJSON.browserWindowOptions;
  browserWindowOptions.icon = __dirname + '/' + browserWindowOptions.icon;
  var window = new BrowserWindow(browserWindowOptions);
  windows[window.id] = window;
  window.focus();
  window.webContents.on("will-navigate", function(e) {
      e.preventDefault();
      window.webContents.send("app", "will-navigate");
  });

  if (process.platform == 'win32') {
    window.on("blur", function() {
      if (window.webContents)
        window.webContents.send("app", "blur");
    });
    window.on("focus", function() {
      if (window.webContents)
        window.webContents.send("app", "focus");
    });
  } else {
    window.on("blur", function() {
      window.webContents.send("app", "blur");
    });
    window.on("focus", function() {
      window.webContents.send("app", "focus");
    });
  }
  window.on("devtools-opened", function() {
    window.webContents.send("devtools", "disconnect");
  });
  window.on("devtools-closed", function() {
    window.webContents.send("devtools", "reconnect!");
  });

  // and load the index.html of the app.
  window.loadUrl('file://' + __dirname + '/LightTable.html?id=' + window.id);

  // Emitted when the window is closed.
  window.on('closed', function() {
    windows[window.id] = null;
  });

  return window;
};
Example #13
0
	this.initWindow = function(){
		var size = this.screen.getPrimaryDisplay().workAreaSize;

		// https://github.com/atom/electron/blob/master/docs/api/browser-window.md
		mainWindow = new BrowserWindow({
			// icon : '/icon.png', // https://github.com/atom/electron/blob/master/docs/api/native-image.md
			// frame: false,
			width: 800, //size.width, //800,
			height: 600, //size.height, //600,
			// transparent:true,
			'subpixel-font-scaling': false,
			// 'auto-hide-menu-bar': true,
			'use-content-size': true,
			title: 'Noted!'
		});

		mainWindow.loadUrl('file://' + path.resolve(path.join(__base, 'root', 'index.html')));

		if( this.debug )
			mainWindow.toggleDevTools();
			// https://github.com/atom/electron/blob/master/docs/tutorial/devtools-extension.md
			// https://developer.chrome.com/extensions/devtools
			// https://developer.chrome.com/extensions/samples#search:devtools
			// https://github.com/facebook/react-devtools

		if ( this.config.maximize )
			mainWindow.maximize();

		mainWindow.focus();

		// 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;
			appIcon = null;
		});

		mainWindow.webContents.on('did-finish-load', function() {
			mainWindow.webContents.send('noted.app.start', true);
		});

		return this;
	};
Example #14
0
function openPreview(path, text) {
  previewWin = new Window({
    width: 1024,
    height: 768
  });

  previewWin.loadUrl(
    'file://' + __dirname + '/preview.html');
  previewWin.focus();

  ipc.on('preview:ready', function() {
    previewWin.webContents.send(
      'preview:render', path, text);
  });

  previewWin.on('closed', function() {
    previewWin = null;
    win.focus();
  });
}
Example #15
0
  start(function (url, nodeChild, mongoChild) {
    console.log('App occupying ', url);
    var cleanup = function () {
      app.quit();
    };
    // Create the browser window.
    var windowOptions = {
      width: 800,
      height: 600,
      resizeable: true,
      frame: true
    };
    mainWindow = new BrowserWindow(windowOptions);
    mainWindow.focus();
    mainWindow.loadUrl(url);

    process.on('uncaughtException', cleanup);

    // Emitted when all windows have been closed and the application will quit.
    // Calling event.preventDefault() will prevent the default behaviour, which is
    // terminating the application.
    app.on('will-quit', function (event) {
      console.log(event);
      console.log('Cleaning up children.');

      if (nodeChild) {
        console.log('cleaning up node child');
        nodeChild.kill('SIGTERM');
      }

      if (mongoChild) {
        console.log('cleaning up mongo child');
        mongoChild.kill('SIGTERM');
      }

    });

    app.on('window-all-closed', function() {
      cleanup();
    });
  });
Example #16
0
  mainWindow.webContents.on('did-finish-load', function() {
    mainWindow.setTitle('Kitematic');
    mainWindow.show();
    mainWindow.focus();

    if (openURL) {
      mainWindow.webContents.send('application:open-url', {
        url: openURL
      });
    }
    app.on('open-url', function (event, url) {
      event.preventDefault();
      mainWindow.webContents.send('application:open-url', {
        url: url
      });
    });

    if (process.env.NODE_ENV !== 'development') {
      autoUpdater.setFeedUrl('https://updates.kitematic.com/releases/latest?version=' + app.getVersion() + '&beta=' + !!settingsjson.beta + '&platform=' + os.platform());
    }
  });
Example #17
0
 app.on('ready', function() {
  mainWindow = new BrowserWindow({
   width: 1200,
   height: 860,
   resizable: true,
   title: "zStackEdit",
   icon: "/zStackEdit.icns",
   icon: "/zStackEdit.ico",
   icon: "/zStackEdit.png"
  });
  mainWindow.setOverlayIcon(
   __dirname + "/zStackEdit.png",
   "Test?");
  mainWindow.setTitle("zStackEdit");
  mainWindow.loadUrl('file://' + __dirname + '/index.html');
  mainWindow.focus();
  mainWindow.on('closed', function() {
   mainWindow = null;
  });
  //mainWindow.toggleDevTools();
 });
  mainWindow.webContents.on('did-finish-load', function() {
    mainWindow.setTitle(settings.title);
    mainWindow.show();
    mainWindow.focus();

    if (openURL) {
      mainWindow.webContents.send('application:open-url', {
        url: openURL
      });
    }
    app.on('open-url', function (event, url) {
      event.preventDefault();
      mainWindow.webContents.send('application:open-url', {
        url: url
      });
    });

    if (process.env.NODE_ENV !== 'development' && settings.autoUpdater.enabled) {
      var feedUrl = settings.feedUrl.replace('[version]', app.getVersion()).replace('[beta]', !!settings.beta);
      autoUpdater.setFeedUrl(feedUrl);
    }
  });
Example #19
0
app.on('ready', function() {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    resizable: false,
    'auto-hide-menu-bar': true,
    'use-content-size': true,
  });
  mainWindow.loadUrl('file://' + __dirname + '/index.html');
  mainWindow.focus();

  if (process.platform == 'darwin') {
    var template = [
      {
        label: 'Electron',
        submenu: [
          {
            label: 'About Electron',
            selector: 'orderFrontStandardAboutPanel:'
          },
          {
            type: 'separator'
          },
          {
            label: 'Services',
            submenu: []
          },
          {
            type: 'separator'
          },
          {
            label: 'Hide Electron',
            accelerator: 'Command+H',
            selector: 'hide:'
          },
          {
            label: 'Hide Others',
            accelerator: 'Command+Shift+H',
            selector: 'hideOtherApplications:'
          },
          {
            label: 'Show All',
            selector: 'unhideAllApplications:'
          },
          {
            type: 'separator'
          },
          {
            label: 'Quit',
            accelerator: 'Command+Q',
            click: function() { app.quit(); }
          },
        ]
      },
      {
        label: 'Edit',
        submenu: [
          {
            label: 'Undo',
            accelerator: 'Command+Z',
            selector: 'undo:'
          },
          {
            label: 'Redo',
            accelerator: 'Shift+Command+Z',
            selector: 'redo:'
          },
          {
            type: 'separator'
          },
          {
            label: 'Cut',
            accelerator: 'Command+X',
            selector: 'cut:'
          },
          {
            label: 'Copy',
            accelerator: 'Command+C',
            selector: 'copy:'
          },
          {
            label: 'Paste',
            accelerator: 'Command+V',
            selector: 'paste:'
          },
          {
            label: 'Select All',
            accelerator: 'Command+A',
            selector: 'selectAll:'
          },
        ]
      },
      {
        label: 'View',
        submenu: [
          {
            label: 'Reload',
            accelerator: 'Command+R',
            click: function() { mainWindow.restart(); }
          },
          {
            label: 'Toggle Full Screen',
            accelerator: 'Ctrl+Command+F',
            click: function() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); }
          },
          {
            label: 'Toggle Developer Tools',
            accelerator: 'Alt+Command+I',
            click: function() { mainWindow.toggleDevTools(); }
          },
        ]
      },
      {
        label: 'Window',
        submenu: [
          {
            label: 'Minimize',
            accelerator: 'Command+M',
            selector: 'performMiniaturize:'
          },
          {
            label: 'Close',
            accelerator: 'Command+W',
            selector: 'performClose:'
          },
          {
            type: 'separator'
          },
          {
            label: 'Bring All to Front',
            selector: 'arrangeInFront:'
          },
        ]
      },
      {
        label: 'Help',
        submenu: [
          {
            label: 'Learn More',
            click: function() { require('shell').openExternal('http://electron.atom.io') }
          },
          {
            label: 'Documentation',
            click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') }
          },
          {
            label: 'Community Discussions',
            click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') }
          },
          {
            label: 'Search Issues',
            click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') }
          }
        ]
      }
    ];

    menu = Menu.buildFromTemplate(template);
    Menu.setApplicationMenu(menu);
  } else {
    var template = [
      {
        label: '&File',
        submenu: [
          {
            label: '&Open',
            accelerator: 'Ctrl+O',
          },
          {
            label: '&Close',
            accelerator: 'Ctrl+W',
            click: function() { mainWindow.close(); }
          },
        ]
      },
      {
        label: '&View',
        submenu: [
          {
            label: '&Reload',
            accelerator: 'Ctrl+R',
            click: function() { mainWindow.restart(); }
          },
          {
            label: 'Toggle &Full Screen',
            accelerator: 'F11',
            click: function() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); }
          },
          {
            label: 'Toggle &Developer Tools',
            accelerator: 'Alt+Ctrl+I',
            click: function() { mainWindow.toggleDevTools(); }
          },
        ]
      },
      {
        label: 'Help',
        submenu: [
          {
            label: 'Learn More',
            click: function() { require('shell').openExternal('http://electron.atom.io') }
          },
          {
            label: 'Documentation',
            click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') }
          },
          {
            label: 'Community Discussions',
            click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') }
          },
          {
            label: 'Search Issues',
            click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') }
          }
        ]
      }
    ];

    menu = Menu.buildFromTemplate(template);
    mainWindow.setMenu(menu);
  }
});
Example #20
0
app.on('ready', function() {
    // Create the browser window
    mainWindow = new BrowserWindow({
        width: 1200,
        height: 800,
        title: appName
    });

    // Verify that git and awk are installed on the host
    if (!shell.which('git') || !shell.which('awk')) {
        Menu.setApplicationMenu(Menu.buildFromTemplate(appMenu));
        mainWindow.loadUrl('file://' + __dirname + '/rendering/config-error.html');
        mainWindow.focus();
        return;
    }

    // Load the renderer
    mainWindow.loadUrl('file://' + __dirname + '/rendering/index.html');
    mainWindow.focus();

    // Emitted when the window is closed.
    mainWindow.on('closed', function() {
        // De-reference 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;
    });

    // Create the app menu --------------------------------------------------
    appMenu.push(
        {
            label: 'File',
            submenu: [
                {
                    label: 'Open',
                    accelerator: 'Command+O',
                    click: function() {
                        showOpenDialog();
                    }
                }
            ]
        },
        {
            label: 'Edit',
            submenu: [
                {
                    label: 'Copy',
                    accelerator: 'Command+C',
                    selector: 'copy:'
                }
            ]
        }
    );
    if (process.env.DEBUG) {
        // Add some dev tools if the DEBUG environment variable is set
        appMenu.push(
            {
                label: 'Developer',
                submenu: [
                    {
                        label: 'Toggle DevTools',
                        accelerator: 'Alt+Command+I',
                        click: function () {
                            BrowserWindow.getFocusedWindow().toggleDevTools();
                        }
                    },
                    {
                        label: 'Reload',
                        accelerator: 'Command+R',
                        click: function () {
                            BrowserWindow.getFocusedWindow().reload();
                        }
                    }
                ]
            }
        );
    }
    Menu.setApplicationMenu(Menu.buildFromTemplate(appMenu));


    // Initialize IPC handlers to communicate with the renderer --------------

    require('ipc').on('getLargeFiles', function(event, numberOfFiles) {
        getLargeFiles(numberOfFiles);
    });

    require('ipc').on('showOpenDialog', function() {
        showOpenDialog();
    });

    require('ipc').on('getCommitDetails', function(event, commitSHA) {
        runGit('Load commit', 'show --name-status ' + commitSHA, function(code, output){
            event.sender.send('commitDetailsReceived', output);
        });
    });

});
Example #21
0
app.on('ready', function () {
	var subpy = require('child_process').spawn('python', [__dirname + 'extend/hello.py']);
	runtime.emit(runtime.events.INIT_ROUTES, appMenu);

	mainWindow = new BrowserWindow({
		width: 800,
		height: 640,
		'min-width': 800,
		'min-height': 400,
		resizable: true,
		'standard-window': false,
		'fullscreen': false,
		'frame': true
	});

	// initialize runtime reference to main window
	runtime.windowId = mainWindow.id;

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

	mainWindow.on('closed', function () {
		mainWindow = null;
		subpy.kill('SIGINT');
	});

	// Dock Menu (Mac)
	if (process.platform === 'darwin') {
		var dockMenu = Menu.buildFromTemplate([
			{ label: 'New Window', click: function() { console.log('New Window'); } },
			{ label: 'New Window with Settings', submenu: [
				{ label: 'Basic' },
				{ label: 'Pro'}
			]},
			{ label: 'New Command...'}
		]);
		app.dock.setMenu(dockMenu);
	}

	// Application Menu
	runtime.emit(runtime.events.INIT_APP_MENU, appMenu);

	var template = appMenu.template;
	menu = Menu.buildFromTemplate(template);

	if (process.platform === 'darwin') {
		Menu.setApplicationMenu(menu);
	} else {
		mainWindow.setMenu(menu);
	}


	ipc.on('mqtt', function(event, arg) {
		var mqtt    = require('mqtt');
		var client  = mqtt.connect('mqtt://' + arg.mqttServer);

		client.on('connect', function () {
			client.subscribe(arg.mqttTopic);
			client.publish(arg.mqttTopic, arg.mqttMessage);
			event.returnValue = {
				connected: true
			}
		});

		client.on('message', function (topic, message) {
			event.sender.send('synchronous-mqtt', message.toString());
			client.end();
		});
	});

	ipc.on('coap', function(event, arg) {
		var coap    = require('coap');
		var server = 'coap://' + arg.coapServer + '/topics/' + arg.coapTopic;
		var req  = coap.request(server);

		req.on('response', function(res) {
			event.returnValue = {
				response: res.payload.toString()
			}
		});

		req.end();
	});

	ipc.on('serialPort', function(event, arg) {
		var serialPort = require("serialport");
		console.log("===============");
		serialPort.list(function (err, ports) {
			ports.forEach(function(port) {
				console.log(port.comName);
				console.log(port.pnpId);
				console.log(port.manufacturer);
			});
		});
		event.returnValue = {};
	});
});
Example #22
0
 /**
 * Focuses a window
 */
 focus () {
   this.window.focus()
 }
Example #23
0
 ipc.on('focus', function () {
   win.focus()
 })
app.on('ready', () => {

    const mainWindow = new BrowserWindow({
        minWidth: 930,
        minHeight: 600,
        width: 960,
        height: 650,
        resizable: true,
        icon: path.join(__dirname, '../images/icon.png'),
        title: 'Netify Jump',
        center: true,
        frame: false,
        show: false
    });

    const appIcon = tray({
        close: app.quit,
        show: () => {
            mainWindow.show();
            mainWindow.focus();
        }
    });


    if (args.dev) {
        mainWindow.show();
        mainWindow.toggleDevTools();
        mainWindow.focus();
        console.info('Dev Mode Active: Developer Tools Enabled.')
    }


    mainWindow.loadURL(path.normalize('file://' + path.join(__dirname, '../index.html')));


    mainWindow.webContents.on('new-window', event => {
        event.preventDefault();
    });

    mainWindow.webContents.on('will-navigate', (event, url) => {
        if (url.indexOf('build/index.html#') < 0) {
            event.preventDefault();
        }
    });

    mainWindow.webContents.on('did-finish-load', () => {
        mainWindow.show();
        mainWindow.focus();
    });

    mainWindow.on('close', app.quit);

    ipcMain.on('app:get:maximized', (event) => {
        event.returnValue = mainWindow.isMaximized();
    });

    ipcMain.on('app:maximize', (event, state) => {
        state ? mainWindow.maximize() : mainWindow.unmaximize();
    });

    ipcMain.on('app:minimize', () => {
        mainWindow.hide();
        if (!minimzeInfoShown) {
            minimzeInfoShown = true;
            appIcon.displayBalloon({
                title: 'Netify Jump has been minimized to tray',
                content: 'Netify Jump is still running and can be restored by clicking its tray icon.'
            });
        }
    });

    ipcMain.on('app:toggleDevTools', () => {
        mainWindow.show();
        mainWindow.toggleDevTools();
        mainWindow.focus();
        console.info('Developer Tools Toggled.');
    });

    ipcMain.on('app:close', app.quit);

});
Example #25
0
app.on('ready', () => {
    var checkingQuit = false;
    var canQuit = false;
    const screenSize = require('screen').getPrimaryDisplay().workAreaSize;

    var mainWindow = new BrowserWindow({
        minWidth: 960,
        minHeight: 500,
        width: 960,
        height: screenSize.height * 0.7,
        icon: 'images/icons/librarian_icon.png',
        'standard-window': true,
        'auto-hide-menu-bar': true,
        resizable: true,
        title: 'ΛLΞXΛNDRIΛ Librarian',
        center: true,
        frame: true,
        show: false
    });

    if (args.dev) {
        mainWindow.show();
        mainWindow.toggleDevTools();
        mainWindow.focus();
        console.info('Dev Mode Active: Developer Tools Enabled.')
    }

    mainWindow.setMenu(null);

    mainWindow.loadURL(path.normalize('file://' + path.join(__dirname, '../index.html')));

    mainWindow.webContents.on('new-window', e => e.preventDefault());

    mainWindow.webContents.on('will-navigate', (e, url) => {
        if (url.indexOf('build/index.html#') < 0) {
            e.preventDefault();
        }
    });

    mainWindow.webContents.on('did-finish-load', () => {
        mainWindow.setTitle('ΛLΞXΛNDRIΛ Librarian');
        mainWindow.show();
        mainWindow.focus();
    });

    const helper = {
        toggleVisibility: () => {
            if (mainWindow) {
                const isVisible = mainWindow.isVisible();
                if (isVisible) {
                    if (process.platform == 'darwin') {
                        app.dock.hide();
                    }
                    mainWindow.hide();
                } else {
                    if (process.platform == 'darwin') {
                        app.dock.show();
                    }
                    mainWindow.show();
                }
            }
        },
        quit: () => {
            canQuit = true;
            app.quit()
        }
    };

    mainWindow.on('close', (event) => {
        if (!canQuit) {
            helper.toggleVisibility();
            return event.preventDefault();
        } else
            app.quit();
    });

    trayTemplate.init(helper);
});
Example #26
0
 mainWindow.webContents.on('did-finish-load', () => {
     mainWindow.show()
     mainWindow.focus()
 })
 show: () => {
     mainWindow.show();
     mainWindow.focus();
 }
Example #28
0
app.on('ready', function() {
  app.commandLine.appendSwitch('js-flags', '--harmony_collections');

  mainWindow = new BrowserWindow({
    width: 1400,
    height: 800,
    resizable: true,
    'use-content-size': true,
  });
  mainWindow.loadUrl('file://' + __dirname + '/index.html');

  mainWindow.focus();

  var printer = function(message, level, type) {
    mainWindow.webContents.send('insertRow', message, level, type)
  }

  time = require('./time')(printer)

  var template = [{
    label: "About",
    submenu: [{
      label: "About",
      click: function() {
        mainWindow.webContents.send('about')
      }
    }]
  }, {
    label: 'File',
    submenu: [{
      label: 'Review',
      click: function() {
        time.reviewer(false);
      }
    }, {
      label: 'Approve',
      click: function() {
        time.reviewer(true);
      }
    }, {
      label: 'Close',
      click: function() {
        mainWindow.close();
      }
    }, ]
  }, {
    label: 'View',
    submenu: [{
      label: 'Reload',
      accelerator: 'Ctrl+R',
      click: function() {
        mainWindow.restart();
      }
    }, {
      label: 'Enter Fullscreen',
      click: function() {
        mainWindow.setFullScreen(true);
      }
    }, {
      label: 'Exit Fullscreen',
      click: function() {
        mainWindow.setFullScreen(false);
      }
    }, {
      label: 'Toggle DevTools',
      accelerator: 'Alt+Ctrl+I',
      click: function() {
        mainWindow.toggleDevTools();
      }
    }, ]
  }];

  ipc.on('disapprove', function(event, id, reason) {
    time.disapprover(event, id, reason)
  });

  menu = Menu.buildFromTemplate(template);
  Menu.setApplicationMenu(menu);
});
Example #29
0
 mainWindow.webContents.on('did-finish-load', function() {
     mainWindow.setMinimumSize(881, 400);
     mainWindow.openDevTools();
     mainWindow.show();
     mainWindow.focus();
 });
 ipcMain.on('app:toggleDevTools', () => {
     mainWindow.show();
     mainWindow.toggleDevTools();
     mainWindow.focus();
     console.info('Developer Tools Toggled.');
 });