fix: use window.maximize() instead of explicit workArea dimensions
Electron screen.workArea is unreliable on KDE — returns full bounds, causing the window to extend behind the taskbar. Delegating to the native WM via mainWindow.maximize() works correctly on KDE, macOS, and Linux.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { app, BrowserWindow, ipcMain, screen } from 'electron';
|
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import { loadSeedConfig } from './config_loader';
|
import { loadSeedConfig } from './config_loader';
|
||||||
@@ -18,13 +18,9 @@ async function createWindow() {
|
|||||||
cachedFullConfig = await fetchFullConfig(cachedSeed);
|
cachedFullConfig = await fetchFullConfig(cachedSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { workArea } = screen.getPrimaryDisplay();
|
|
||||||
|
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: workArea.width,
|
width: 1280,
|
||||||
height: workArea.height,
|
height: 800,
|
||||||
x: workArea.x,
|
|
||||||
y: workArea.y,
|
|
||||||
title: 'OSIT Aether Launcher (Native)',
|
title: 'OSIT Aether Launcher (Native)',
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, '../preload/index.js'),
|
preload: path.join(__dirname, '../preload/index.js'),
|
||||||
@@ -33,6 +29,10 @@ async function createWindow() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Let the native window manager maximize — more reliable than using screen.workArea,
|
||||||
|
// which Electron under-reports on KDE and other Linux DEs.
|
||||||
|
mainWindow.maximize();
|
||||||
|
|
||||||
let targetUrl = 'http://demo.localhost:5173';
|
let targetUrl = 'http://demo.localhost:5173';
|
||||||
if (cachedFullConfig && cachedFullConfig.native_device) {
|
if (cachedFullConfig && cachedFullConfig.native_device) {
|
||||||
const device = cachedFullConfig.native_device;
|
const device = cachedFullConfig.native_device;
|
||||||
|
|||||||
Reference in New Issue
Block a user