From 3b9311fde33d96351fe771f7ef618da8e1618f28 Mon Sep 17 00:00:00 2001 From: "Josh.5" Date: Sun, 9 Oct 2022 13:56:53 +1300 Subject: [PATCH] Add dummy screen on startup if no monitor is plugged in --- Dockerfile | 1 + overlay/etc/cont-init.d/70-configure_xorg.sh | 7 +++++++ overlay/templates/xorg/xorg.dummy.conf | 21 ++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 overlay/templates/xorg/xorg.dummy.conf diff --git a/Dockerfile b/Dockerfile index c633127..7fbf006 100644 --- a/Dockerfile +++ b/Dockerfile @@ -179,6 +179,7 @@ RUN \ xserver-xorg-input-libinput \ xserver-xorg-legacy \ xserver-xorg-video-all \ + xserver-xorg-video-dummy \ xvfb \ && \ echo "**** Section cleanup ****" \ diff --git a/overlay/etc/cont-init.d/70-configure_xorg.sh b/overlay/etc/cont-init.d/70-configure_xorg.sh index d9efe8b..8ee4e54 100644 --- a/overlay/etc/cont-init.d/70-configure_xorg.sh +++ b/overlay/etc/cont-init.d/70-configure_xorg.sh @@ -85,6 +85,13 @@ function configure_x_server { else echo "Leaving evdev inputs disabled" fi + + monitor_connected=$(cat /sys/class/drm/card*/status | awk '/^connected/ { print $1; }' | head -n1) + if [[ "X${monitor_connected}" == "X" ]]; then + echo "No monitors connected. Installing dummy xorg.conf" + # Use a dummy display input + cp -fv /templates/xorg/xorg.dummy.conf /etc/X11/xorg.conf + fi } if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then diff --git a/overlay/templates/xorg/xorg.dummy.conf b/overlay/templates/xorg/xorg.dummy.conf new file mode 100644 index 0000000..6021a98 --- /dev/null +++ b/overlay/templates/xorg/xorg.dummy.conf @@ -0,0 +1,21 @@ +Section "Device" + Identifier "Configured Video Device" + Driver "dummy" +EndSection + +Section "Monitor" + Identifier "Configured Monitor" + HorizSync 31.5-48.5 + VertRefresh 50-70 +EndSection + +Section "Screen" + Identifier "Default Screen" + Monitor "Configured Monitor" + Device "Configured Video Device" + DefaultDepth 24 + SubSection "Display" + Depth 24 + Modes "1600x900" + EndSubSection +EndSection