2018-01-12 22:24:18 -05:00
|
|
|
const {app, BrowserWindow, webFrame, Menu, dialog} = require('electron')
|
2017-11-04 20:52:05 -04:00
|
|
|
const path = require('path')
|
|
|
|
const url = require('url')
|
2017-12-26 17:14:58 -05:00
|
|
|
const shell = require('electron').shell
|
2017-11-04 20:52:05 -04:00
|
|
|
|
2018-01-12 15:00:53 -05:00
|
|
|
let is_shown = true;
|
2017-11-04 20:52:05 -04:00
|
|
|
|
2018-01-12 03:09:26 -05:00
|
|
|
app.inspect = function()
|
|
|
|
{
|
2018-01-12 22:03:21 -05:00
|
|
|
app.win.toggleDevTools();
|
2018-01-12 15:00:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
app.toggle_fullscreen = function()
|
|
|
|
{
|
2018-01-12 22:03:21 -05:00
|
|
|
app.win.setFullScreen(app.win.isFullScreen() ? false : true);
|
2018-01-12 15:00:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
app.toggle_visible = function()
|
|
|
|
{
|
2018-01-12 22:03:21 -05:00
|
|
|
if(is_shown){ app.win.hide(); } else{ app.win.show(); }
|
2018-01-12 03:09:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
app.inject_menu = function(m)
|
|
|
|
{
|
|
|
|
Menu.setApplicationMenu(Menu.buildFromTemplate(m));
|
|
|
|
}
|
|
|
|
|
2018-01-12 22:03:21 -05:00
|
|
|
app.win = null;
|
2018-01-12 15:00:53 -05:00
|
|
|
|
2017-11-04 20:52:05 -04:00
|
|
|
app.on('ready', () =>
|
|
|
|
{
|
2018-08-17 18:50:01 -04:00
|
|
|
app.win = new BrowserWindow({width: 405, height: 420, minWidth: 405, minHeight: 420,webPreferences: {zoomFactor: 1.0}, backgroundColor:"#000", frame:false, autoHideMenuBar: true, icon: __dirname + '/icon.ico'})
|
2018-01-31 04:10:48 -05:00
|
|
|
|
2018-05-12 17:50:19 -04:00
|
|
|
app.win.loadURL(`file://${__dirname}/sources/index.html`);
|
2018-08-02 21:48:16 -04:00
|
|
|
app.win.scaleFactor = require('electron').screen.getPrimaryDisplay().scaleFactor;
|
2018-09-11 23:33:47 -04:00
|
|
|
// app.win.toggleDevTools();
|
2018-08-02 18:57:35 -04:00
|
|
|
|
2018-01-12 22:03:21 -05:00
|
|
|
app.win.on('closed', () => {
|
2017-11-04 20:52:05 -04:00
|
|
|
win = null
|
|
|
|
app.quit()
|
|
|
|
})
|
|
|
|
|
2018-01-12 22:03:21 -05:00
|
|
|
app.win.on('hide',function() {
|
2017-11-04 20:52:05 -04:00
|
|
|
is_shown = false;
|
|
|
|
})
|
|
|
|
|
2018-01-12 22:03:21 -05:00
|
|
|
app.win.on('show',function() {
|
2017-11-04 20:52:05 -04:00
|
|
|
is_shown = true;
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('window-all-closed', () =>
|
|
|
|
{
|
|
|
|
app.quit()
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('activate', () => {
|
2018-01-12 22:03:21 -05:00
|
|
|
if (app.win === null) {
|
2017-11-04 20:52:05 -04:00
|
|
|
createWindow()
|
|
|
|
}
|
|
|
|
else{
|
2018-07-26 04:40:06 -04:00
|
|
|
app.win.show();
|
2017-11-04 20:52:05 -04:00
|
|
|
}
|
|
|
|
})
|