From 0c049cf3cb2adde76abe46f8cde692b841cf95e7 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 16 Jan 2020 13:25:45 +0100 Subject: [run-virt/vbox-src] initial multi-monitor support --- .../run-virt-includes/set_runvirt_hardware_variables.inc | 12 +++++++++++- .../openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc | 15 +++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'core/modules/run-virt/data') 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 diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc index c077bb42..f589d2b6 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc @@ -112,10 +112,17 @@ setup_virtual_floppy() { ${RESOLUTION} EOF - cat > "${FLOPPYDIR}/openslx.ini" <<-EOF - [openslx] + ( + echo '[openslx]' + # Ugly hack for multi-monitor support with virtualbox. + # The guest additions properly set up the resolutions of multiple + # monitor, thus we need to disable the resolution feature of + # the openslx.exe as it would break what virtualbox did. + if [ "$PLUGIN_ID" = "vmware" ] || [ "$PLUGIN_ID" = "virtualbox" -a "$DISPLAY_COUNT" -eq 1 ]; then + echo "resolution=$RESOLUTION" + fi + cat <<-EOF username=${UNAME} - resolution=${RESOLUTION} createMissingRemap=${SHARE_CREATE_MISSING_REMAP} remapMode=${SHARE_REMAP_MODE_INI} homeDrive=${SHARE_HOME_DRIVE} @@ -133,7 +140,7 @@ setup_virtual_floppy() { media=${SHARE_MEDIA} other=${SHARE_OTHER} EOF - + ) > "${FLOPPYDIR}/openslx.ini" ln -n -s "${VMCHOOSER_DIR}/data/openslx.exe" "${FLOPPYDIR}/openslx.exe" # If we have a kerberos ticket, copy that one too (TODO: Copy keytab too?) if [ -n "$KRB5CCNAME" ]; then -- cgit v1.2.3-55-g7522