Skip to content

Commit

Permalink
Closes #239 - Increase default window size
Browse files Browse the repository at this point in the history
  • Loading branch information
lrasmus committed Feb 13, 2025
1 parent 6363536 commit f12b1a7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/main.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* `./app/main.prod.js` using webpack. This gives us some performance wins.
*
*/
import { app, shell, BrowserWindow, ipcMain } from 'electron';
import { app, shell, BrowserWindow, ipcMain, screen } from 'electron';
// import { autoUpdater } from 'electron-updater';
import path from 'path';
import { URL } from 'url';
Expand Down Expand Up @@ -87,10 +87,18 @@ const createWindow = async () => {
await installExtensions();
}

// Determine what we want the starting application window size to be, based on the user's primary
// display dimensions. We will default to 70% of the height and width, with a minimum of 1024x768.
const screenSize = screen.getPrimaryDisplay().workAreaSize;
// Important note - you must do Math.floor. If you use a decimal value for width or height, the value
// will just be ignored and the default used.
const defaultWidth = Math.max(Math.floor(screenSize.width * 0.7), 1024);
const defaultHeight = Math.max(Math.floor(screenSize.height * 0.7), 768);

mainWindow = new BrowserWindow({
show: true, // Default was false, but setting to true. We have a sporadic issue where the window wasn't displaying. Let's see if this fixes it.
width: 1024,
height: 728,
width: defaultWidth,
height: defaultHeight,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
Expand Down

0 comments on commit f12b1a7

Please sign in to comment.