Issue
We have an electron app running on X11 without a Window Manager -> directly on the XServer.
We can't get electron to get in fullscreen!
main.js
const { app, BrowserWindow } = require('electron')
let win;
function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 400,
height: 300,
backgroundColor: '#ffffff',
fullscreen:true,
"web-preferences": { "web-security": false }
//icon: `file://${__dirname}/dist/assets/logo.png`
})
win.loadFile(`app/index.html`)
//// uncomment below to open the DevTools.
win.webContents.openDevTools()
// Event when the window is closed.
win.on('closed', function () {
win = null
})
}
// Create window on electron intialization
app.on('ready', createWindow)
We also tried using setFullscreen, nothing works.
The xserver uses the whole screen, so there's no problem with it. Chromium started in fullscreen - no problems.
If we start Electron with an Window Manager, we can press F11 afterwards to make it full size but still doesn't work programmaticly
We tried:
- Setting the width and height with the resolution from the screen itself in the BrowserWindow Constructor.
- Setting Kiosk with .setKiosk(true) and in options kiosk: true
- Setting Fullscreen with .setFullscreen(true) and fullscreen: true
Solution
The Problem was the app wasn't run from electron itself, my script started the index.html file, not the app!
Answered By - filip Answer Checked By - David Goodson (WPSolving Volunteer)