electron BrowserWindow foreground code example

Example 1: electron specify minimum size

new BrowserWindow({
  width: 800, height: 600,
  minHeight: 300,
  minWidth: 300,
  frame:false
})

Example 2: electron specify minimum size

const screenElectron = electron.screen;
const display = screenElectron.getPrimaryDisplay();
const dimensions = display.workAreaSize;
mainWindow = new BrowserWindow({
    width: parseInt(dimensions.width * 0.8),
    height: parseInt(dimensions.height * 0.8),
    minWidth: parseInt(dimensions.width * 0.8),
    minHeight: parseInt(dimensions.height * 0.8),
    maxWidth: dimensions.width,
    maxHeight: dimensions.height,
    icon: `${__dirname}/assets/icon.ico`
  });