mirror of
https://github.com/pierre42100/ComunicDesktop
synced 2024-11-27 06:19:22 +00:00
Updated project
This commit is contained in:
parent
ee02924124
commit
484813ff4d
14
Config.js
Normal file
14
Config.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Project configuration
|
||||
*/
|
||||
|
||||
const Config = {
|
||||
|
||||
/**
|
||||
* URL to access to Comunic
|
||||
*/
|
||||
access_url: 'https://comunic.io'
|
||||
|
||||
}
|
||||
|
||||
module.exports = Config;
|
102
index.js
102
index.js
@ -1,69 +1,57 @@
|
||||
const electron = require('electron');
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const {app, Menu, Tray} = require('electron')
|
||||
const {app, Menu, Tray} = require('electron');
|
||||
|
||||
let mainWindow
|
||||
let tray = null
|
||||
const Config = require("./Config");
|
||||
|
||||
function main(){
|
||||
mainWindow = new BrowserWindow({
|
||||
icon:'icon.png',
|
||||
webPreferences :{
|
||||
nodeIntegration :false
|
||||
},
|
||||
show: false
|
||||
});
|
||||
mainWindow.maximize();
|
||||
//createWindow --> create the window
|
||||
mainWindow.loadURL('https://comunic.io');
|
||||
//set the url who must be open
|
||||
let mainWindow;
|
||||
let tray = null;
|
||||
let page_finished_loading = false;
|
||||
|
||||
mainWindow.on('closed', () =>{
|
||||
mainWindow = null;
|
||||
});
|
||||
//To close the window
|
||||
|
||||
tray = new Tray('./icon.png');
|
||||
|
||||
tray.setToolTip('Comunic');
|
||||
|
||||
|
||||
tray.setContextMenu(menu_1);
|
||||
|
||||
console.log("Started succesfully");
|
||||
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.show()
|
||||
})
|
||||
};
|
||||
const menu_1 = Menu.buildFromTemplate([{
|
||||
label: "Ouvrir la version stable",
|
||||
click: () => {
|
||||
mainWindow.loadURL('https://communiquons.org');
|
||||
tray.setContextMenu(menu_2)
|
||||
}
|
||||
},
|
||||
{
|
||||
label : 'Quit',
|
||||
click: () => {
|
||||
app.quit();
|
||||
console.log("Closed");
|
||||
}
|
||||
}]);
|
||||
const menu_2 = Menu.buildFromTemplate([{
|
||||
label: "Ouvrir la nouvelle version",
|
||||
click: () =>{
|
||||
mainWindow.loadURL('https://comunic.io');
|
||||
tray.setContextMenu(menu_1)
|
||||
}
|
||||
},
|
||||
{
|
||||
label:'Quit',
|
||||
const menu = Menu.buildFromTemplate([{
|
||||
label : 'Close',
|
||||
click: () => {
|
||||
app.quit();
|
||||
console.log("Closed");
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
console.log("Starting...");
|
||||
app.on('ready', main);
|
||||
app.on('ready', () => {
|
||||
|
||||
//Create and show main window
|
||||
mainWindow = new BrowserWindow({
|
||||
icon:'icon.png',
|
||||
webPreferences: {
|
||||
nodeIntegration: false
|
||||
},
|
||||
//show: false
|
||||
});
|
||||
//mainWindow.maximize();
|
||||
|
||||
//set the url which must be open
|
||||
mainWindow.loadURL(Config.access_url);
|
||||
|
||||
|
||||
mainWindow.on('closed', () =>{
|
||||
//To close the window
|
||||
mainWindow = null;
|
||||
});
|
||||
|
||||
|
||||
//Create tray
|
||||
tray = new Tray('./icon.png');
|
||||
tray.setToolTip('Comunic');
|
||||
tray.setContextMenu(menu);
|
||||
|
||||
console.log("Started successfully");
|
||||
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('did-finish-load', function() {
|
||||
page_finished_loading = true;
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user