summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc')
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc
index 414c654a..91577f71 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc
@@ -151,6 +151,15 @@ set_serial_ports() {
readonly SERIAL0 PARALLEL0
}
+get_display_count() {
+ declare -g DISPLAY_COUNT="$(xrandr | grep -c -w 'connected')"
+ if ! [[ "$DISPLAY_COUNT" =~ ^[1-9]$ ]]; then
+ writelog "Weird monitor count detected ($DISPLAY_COUNT). Falling back to 1."
+ DISPLAY_COUNT=1
+ fi
+ readonly DISPLAY_COUNT
+}
+
## MAIN ##
call_post_source \
import_hwinfo \
@@ -158,5 +167,6 @@ call_post_source \
set_virt_mac \
set_virt_hostname \
set_serial_ports \
- check_optical_drives
+ check_optical_drives \
+ get_display_count