'use strict';
const path = require('path');
const { app, BrowserWindow, Menu, globalShortcut} = require('electron');
const unhandled = require('electron-unhandled');
const debug = require('electron-debug');
const {is} = require('electron-util');
unhandled();
debug();
contextMenu();
app.setAppUserModelId('com.pixzeldigital.attrfidqrcode');
let mainWindow;
const createMainWindow = async () => {
const win = new BrowserWindow({
title: app.name,
show: false,
width: 1024,
height: 768,
frame: false
});
win.on('ready-to-show', () => {
win.maximize();
win.show();
});
win.on('closed', () => {
mainWindow = undefined;
});
await win.loadFile(path.join(__dirname, 'vue/dist/index.html'));
return win;
};
if (!app.requestSingleInstanceLock()) {
app.quit();
}
app.on('second-instance', () => {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.show();
}
});
app.on('window-all-closed', () => {
if (!is.macos) {
app.quit();
}
});
app.on('activate', async () => {
if (!mainWindow) {
mainWindow = await createMainWindow();
}
});
app.on('ready', () => {
globalShortcut.register('Control+Shift+I', () => {
return false;
});
});
(async () => {
await app.whenReady();
Menu.setApplicationMenu(null);
mainWindow = await createMainWindow();
})();