2017-11-05 00:52:05 +00:00
|
|
|
const {app, BrowserWindow, webFrame, Menu} = require('electron')
|
|
|
|
const path = require('path')
|
|
|
|
const url = require('url')
|
2017-12-26 22:14:58 +00:00
|
|
|
const shell = require('electron').shell
|
2017-11-05 00:52:05 +00:00
|
|
|
|
|
|
|
let win
|
2018-01-12 20:00:53 +00:00
|
|
|
let is_shown = true;
|
2017-11-05 00:52:05 +00:00
|
|
|
|
2018-01-12 08:09:26 +00:00
|
|
|
app.inspect = function()
|
|
|
|
{
|
2018-01-12 20:00:53 +00:00
|
|
|
this.win.webContents.openDevTools();
|
|
|
|
}
|
|
|
|
|
|
|
|
app.toggle_fullscreen = function()
|
|
|
|
{
|
|
|
|
win.setFullScreen(win.isFullScreen() ? false : true);
|
|
|
|
}
|
|
|
|
|
|
|
|
app.toggle_visible = function()
|
|
|
|
{
|
|
|
|
if(is_shown){ win.hide(); } else{ win.show(); }
|
2018-01-12 08:09:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
app.inject_menu = function(m)
|
|
|
|
{
|
|
|
|
Menu.setApplicationMenu(Menu.buildFromTemplate(m));
|
|
|
|
}
|
|
|
|
|
2018-01-12 20:00:53 +00:00
|
|
|
app.win = win;
|
|
|
|
|
2017-11-05 00:52:05 +00:00
|
|
|
app.on('ready', () =>
|
|
|
|
{
|
2017-12-26 22:12:23 +00:00
|
|
|
win = new BrowserWindow({width: 400, height: 420, minWidth: 400, minHeight: 400, backgroundColor:"#000", frame:false, autoHideMenuBar: true, icon: __dirname + '/icon.ico'})
|
2017-11-05 00:52:05 +00:00
|
|
|
|
2018-01-12 20:00:53 +00:00
|
|
|
win.loadURL(`file://${__dirname}/sources/index.html`);
|
2018-01-12 08:09:26 +00:00
|
|
|
|
2017-11-05 00:52:05 +00:00
|
|
|
win.on('closed', () => {
|
|
|
|
win = null
|
|
|
|
app.quit()
|
|
|
|
})
|
|
|
|
|
|
|
|
win.on('hide',function() {
|
|
|
|
is_shown = false;
|
|
|
|
})
|
|
|
|
|
|
|
|
win.on('show',function() {
|
|
|
|
is_shown = true;
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('window-all-closed', () =>
|
|
|
|
{
|
|
|
|
app.quit()
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('activate', () => {
|
|
|
|
if (win === null) {
|
|
|
|
createWindow()
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|