Electron built app, set minimum display size

396 Views Asked by At

I need to set the minimum width and height on my desktop app when the user runs it after installation. As you see the electron browserWindows changed

I already add minWidth & minHeight to BroserWindow, but doesn't work.

 const win = new BrowserWindow({
    width: 1600,
    height: 700,
    minWidth: 1024,
    minHeight: 576,
    frame: false,
    webPreferences: {
      // Use pluginOptions.nodeIntegration, leave this alone
      // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
      // devTools: false,
      nodeIntegration: false,
      preload: path.join(__dirname, "preload.js"),
    },
  });

also added min-width & min-height in body:

html body {
  min-width: 1024px;
  min-height: 576px;
  padding: 0;
  margin: 0;
  font-family: "Noto Sans", sans-serif;
  box-sizing: border-box;
  background-color: rgb(31, 31, 31);
}

This is installed app on

any idea?

0

There are 0 best solutions below