Skip to content

Commit

Permalink
fix electron width/heigth when using xrandr under bullseye (#3161)
Browse files Browse the repository at this point in the history
This PR uses `electron.screen.getPrimaryDisplay().workAreaSize` under
electron to get the screen size.

If this fails the current defaults (800x600) are used.

This solves some problems with xrandr under bullseye where the sreen
comes up with 800x600 instead of fullscreen, e.g. described
[here](https://khassel.gitlab.io/magicmirror/pi-modules/).

Tested this on my pi setup.

By the way, the Issue #1919 is back on my side (not related to this PR)
...
  • Loading branch information
khassel authored Aug 12, 2023
1 parent 58cdfa3 commit 156db32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ _This release is scheduled to be released on 2023-10-01._

- Fix undefined formatTime method in clock module (#3143)
- Fix clientonly startup fails after async added (#3151)
- Fix electron width/heigth when using xrandr under bullseye

## [2.24.0] - 2023-07-01

Expand Down
13 changes: 11 additions & 2 deletions js/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ let mainWindow;
*
*/
function createWindow() {
// see https://www.electronjs.org/docs/latest/api/screen
// Create a window that fills the screen's available work area.
let electronSize = (800, 600);
try {
electronSize = electron.screen.getPrimaryDisplay().workAreaSize;
} catch {
Log.warn("Could not get display size, using defaults ...");
}

let electronSwitchesDefaults = ["autoplay-policy", "no-user-gesture-required"];
app.commandLine.appendSwitch(...new Set(electronSwitchesDefaults, config.electronSwitches));
let electronOptionsDefaults = {
width: 800,
height: 600,
width: electronSize.width,
height: electronSize.height,
x: 0,
y: 0,
darkTheme: true,
Expand Down

0 comments on commit 156db32

Please sign in to comment.