FIX: Focus bug

This commit is contained in:
Robert Kossessa
2024-02-07 18:49:27 +01:00
parent 776f852568
commit bb554f6d34
2 changed files with 12 additions and 1 deletions

View File

@@ -5,6 +5,11 @@
<link rel="icon" href="/src/assets/favicon.png"> <link rel="icon" href="/src/assets/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ZERO/ONE Configuration Suite</title> <title>ZERO/ONE Configuration Suite</title>
<style>
html {
background: black;
}
</style>
</head> </head>
<body class="dark bg-background"> <body class="dark bg-background">
<div id="app"></div> <div id="app"></div>

View File

@@ -34,7 +34,7 @@ const createMainWindow = () => {
maximizable: true, maximizable: true,
fullscreenable: false, fullscreenable: false,
center: true, center: true,
backgroundColor: '#000', backgroundColor: 'black',
icon: path.join(__dirname, `/assets/favicon.png`), icon: path.join(__dirname, `/assets/favicon.png`),
webPreferences: { webPreferences: {
devTools: isDevelopment, devTools: isDevelopment,
@@ -72,9 +72,13 @@ const createLoadingWindow = (mainWindow) => {
show: false, show: false,
width: 400, width: 400,
height: 600, height: 600,
resizable: false,
fullscreenable: false,
maximizable: false,
transparent: true, transparent: true,
frame: false, frame: false,
center: true, center: true,
backgroundColor: 'black',
webPreferences: { webPreferences: {
devTools: isDevelopment, devTools: isDevelopment,
}, },
@@ -87,6 +91,7 @@ const createLoadingWindow = (mainWindow) => {
loadingTimeout = setTimeout(() => { loadingTimeout = setTimeout(() => {
loading = false loading = false
mainWindow.show() mainWindow.show()
mainWindow.focus()
loadingWindow.close() loadingWindow.close()
}, Math.max(0, splashTime - (Date.now() - startTime))) }, Math.max(0, splashTime - (Date.now() - startTime)))
}) })
@@ -99,6 +104,7 @@ const createLoadingWindow = (mainWindow) => {
}) })
loadingWindow.webContents.once('did-finish-load', () => { loadingWindow.webContents.once('did-finish-load', () => {
loadingWindow.show() loadingWindow.show()
loadingWindow.focus()
}) })
if (LOADING_WINDOW_VITE_DEV_SERVER_URL) { if (LOADING_WINDOW_VITE_DEV_SERVER_URL) {
loadingWindow.loadURL(`${LOADING_WINDOW_VITE_DEV_SERVER_URL}/loading.html`) loadingWindow.loadURL(`${LOADING_WINDOW_VITE_DEV_SERVER_URL}/loading.html`)