mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
commit
accdad432b
4 changed files with 34 additions and 19 deletions
|
@ -1,5 +1,7 @@
|
||||||
var app = require('app'); // Module to control application life.
|
var app = require('app'); // Module to control application life.
|
||||||
var BrowserWindow = require('browser-window'); // Module to create native browser window.
|
var BrowserWindow = require('browser-window'); // Module to create native browser window.
|
||||||
|
var Menu = require('menu');
|
||||||
|
var Tray = require('tray');
|
||||||
|
|
||||||
// Report crashes to our server.
|
// Report crashes to our server.
|
||||||
require('crash-reporter').start();
|
require('crash-reporter').start();
|
||||||
|
@ -7,33 +9,46 @@ require('crash-reporter').start();
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
var mainWindow = null;
|
var mainWindow = null;
|
||||||
|
var appIcon = null;
|
||||||
|
var TRAY_ICON = 'resources/tray-icon.png';
|
||||||
|
var APP_ICON = 'resources/tray-icon.png';
|
||||||
|
|
||||||
// Quit when all windows are closed.
|
// Quit when all windows are closed.
|
||||||
app.on('window-all-closed', function() {
|
app.on('window-all-closed', function() {
|
||||||
// On OS X it is common for applications and their menu bar
|
// On OS X it is common for applications and their menu bar
|
||||||
// to stay active until the user quits explicitly with Cmd + Q
|
// to stay active until the user quits explicitly with Cmd + Q
|
||||||
if (process.platform != 'darwin') {
|
if (process.platform != 'darwin') {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
// Create the browser window.
|
// Create tray icon
|
||||||
mainWindow = new BrowserWindow({width: 800, height: 600});
|
appIcon = new Tray(TRAY_ICON);
|
||||||
|
appIcon.setToolTip('High Fidelity Console');
|
||||||
|
var contextMenu = Menu.buildFromTemplate([{
|
||||||
|
label: 'Quit',
|
||||||
|
accelerator: 'Command+Q',
|
||||||
|
click: function() { app.quit(); }
|
||||||
|
}]);
|
||||||
|
appIcon.setContextMenu(contextMenu);
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// Create the browser window.
|
||||||
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
mainWindow = new BrowserWindow({width: 800, height: 600, icon: APP_ICON});
|
||||||
|
|
||||||
// Open the DevTools.
|
// and load the index.html of the app.
|
||||||
mainWindow.webContents.openDevTools();
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
|
|
||||||
// Emitted when the window is closed.
|
// Open the DevTools.
|
||||||
mainWindow.on('closed', function() {
|
mainWindow.webContents.openDevTools();
|
||||||
// Dereference the window object, usually you would store windows
|
|
||||||
// in an array if your app supports multi windows, this is the time
|
// Emitted when the window is closed.
|
||||||
// when you should delete the corresponding element.
|
mainWindow.on('closed', function() {
|
||||||
mainWindow = null;
|
// 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;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
BIN
console/resources/tray-icon.png
Normal file
BIN
console/resources/tray-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
console/resources/tray-icon@2x.png
Normal file
BIN
console/resources/tray-icon@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
console/resources/tray-icon@4x.png
Normal file
BIN
console/resources/tray-icon@4x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Loading…
Reference in a new issue