app: keep installer in foreground

This commit is contained in:
Jeffrey Morgan
2023-07-16 20:25:11 -07:00
parent 9386073e96
commit f923855906
3 changed files with 49 additions and 40 deletions

View File

@@ -6,6 +6,7 @@ import 'winston-daily-rotate-file'
import * as path from 'path'
import { analytics, id } from './telemetry'
import { installed, install } from './install'
require('@electron/remote/main').initialize()
@@ -40,12 +41,13 @@ function firstRunWindow() {
frame: false,
fullscreenable: false,
resizable: false,
movable: false,
transparent: true,
movable: true,
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
alwaysOnTop: true,
})
require('@electron/remote/main').enable(welcomeWindow.webContents)
@@ -53,6 +55,8 @@ function firstRunWindow() {
// and load the index.html of the app.
welcomeWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY)
welcomeWindow.on('ready-to-show', () => welcomeWindow.show())
// for debugging
// welcomeWindow.webContents.openDevTools()
@@ -151,15 +155,15 @@ app.on('ready', () => {
createSystemtray()
server()
if (!store.has('first-time-run')) {
// This is the first run
app.setLoginItemSettings({ openAtLogin: true })
firstRunWindow()
store.set('first-time-run', true)
} else {
// The app has been run before
if (store.get('first-time-run') && installed()) {
app.setLoginItemSettings({ openAtLogin: app.getLoginItemSettings().openAtLogin })
return
}
// This is the first run or the CLI is no longer installed
app.setLoginItemSettings({ openAtLogin: true })
firstRunWindow()
})
// Quit when all windows are closed, except on macOS. There, it's common