|
@@ -12,10 +12,28 @@ let settings = readSettings()
|
|
|
// const isDevMode = process.execPath.match(/[\\/]electron/)
|
|
|
const isDevMode = settings.appMode === 'development'
|
|
|
|
|
|
+const AppAutolaunch = new Autolaunch({
|
|
|
+ name: 'Servidor de Impresión',
|
|
|
+ isHidden: true
|
|
|
+})
|
|
|
+
|
|
|
if (isDevMode) {
|
|
|
enableLiveReload()
|
|
|
}
|
|
|
|
|
|
+const isSecondInstance = app.makeSingleInstance(() => {
|
|
|
+ if (win) {
|
|
|
+ if (win.isMinimized()) {
|
|
|
+ win.restore()
|
|
|
+ win.focus()
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+if (isSecondInstance) {
|
|
|
+ app.quit()
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
@@ -44,6 +62,18 @@ const createWindow = async () => {
|
|
|
win.webContents.openDevTools()
|
|
|
}
|
|
|
|
|
|
+ AppAutolaunch.enable()
|
|
|
+
|
|
|
+ AppAutolaunch.isEnabled().then(enable => {
|
|
|
+ if (enable) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ AppAutolaunch.enable()
|
|
|
+ }).catch(e => {
|
|
|
+ console.log(e)
|
|
|
+ })
|
|
|
+
|
|
|
win.once('ready-to-show', () => {
|
|
|
win.show()
|
|
|
})
|