Balena browser - force 1080p

Hi,

Is it possible to force 1080p on 4k displays when using X11 (browser running on a pi4).

I have tried;

BALENA_HOST_CONFIG_hdmi_mode  16
BALENA_HOST_CONFIG_hdmi_group 1

but this only achieves a 1080p window in the top-left corner of the display.

I have also forked the browser repo and added the following to the startx.sh

if [[ -z "$FORCE_RESOLUTION" ]]
then
  echo "Automatic resolution, listing modes:"
  xrandr -d :0
else
  echo "Forcing resolution: $FORCE_RESOLUTION"
  xrandr -d :$DISPLAY_NUM -s $FORCE_RESOLUTION
fi

and the associated env var in balenacloud with a value of 1920x1080@60

This appears to work when the release is downloaded but reverts back to a 1920x1080 window in the top-left corner on reboot. I believe this happens as subsequent container starts result in;
Can't open display :0
when running xrandr

Thanks!

if [[ -z "$FORCE_RESOLUTION" ]]
then
  echo "Automatic resolution, listing modes:"
  xrandr
else
  echo "Forcing resolution: $FORCE_RESOLUTION"
  xrandr -s $FORCE_RESOLUTION
fi

The above added to startx.sh has so far met all my requirements. The value of env var FORCE_RESOLUTION should be in xrandr expected format e.g 1920x1080@60.

As $DISPLAY is already being set, specifying a display causes the “can’t open” error.

Additionally WINDOW_SIZE can be used to resize the chromium window to match the display resolution.

note: that the resolution must be supported by both the device and the display.
fork: GitHub - AbstractionByDesign/browser: A drop-in web browser block