electron: Frameless window height cannot be lower than 39 on Windows

Preflight Checklist

Electron Version

15.1.2

What operating system are you using?

Windows

Operating System Version

Windows 10 Enterprise 1909

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Window height should be 25

Actual Behavior

Window height is 39

Testcase Gist URL

No response

Additional Information

const { app, BrowserWindow } = require('electron');

app.on('ready', () => {
  const win = new BrowserWindow({
    width: 400,
    height: 25,
    frame: false,
    show: false,
    thickFrame: false,
  });

  win.loadURL('https://github.com').then(() => {
    win.webContents.executeJavaScript(
      'document.body.innerHTML = innerHeight;' +
      'document.body.style.boxShadow = "inset 0 0 0 1px lightblue";');
  });

  win.once('ready-to-show', () => {
    win.show();
    win.setSize(400, 25);
  });
});

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (14 by maintainers)

Most upvoted comments

I found the following work around, which might work in my case https://github.com/electron/electron/issues/32302#issuecomment-1009776445

The work around I found is using setShape function of BrowserWindow and passing to it an array with the expected rectangle shape. https://www.electronjs.org/docs/latest/api/browser-window#winsetshaperects-windows-linux-experimental

thanks! This works.

The work around I found is using setShape function of BrowserWindow and passing to it an array with the expected rectangle shape. https://www.electronjs.org/docs/latest/api/browser-window#winsetshaperects-windows-linux-experimental

@virtuecoder not using a proper title for your bug makes it much less likely to be noticed and fixed.