From 286ac1bcfe7e98690be44b28e36ca8f3384a6ad7 Mon Sep 17 00:00:00 2001 From: Doc Norberg Date: Sat, 18 Nov 2023 18:30:19 -0800 Subject: [PATCH] Add options to directly specify VM width and height on cmdline or config --- quickemu | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/quickemu b/quickemu index ee519f7..c00388c 100755 --- a/quickemu +++ b/quickemu @@ -770,7 +770,11 @@ function vm_boot() { # Try and coerce the display resolution for Linux guests only. if [ "${guest_os}" == "linux" ]; then - VIDEO="${VIDEO},xres=${X_RES},yres=${Y_RES}" + if [ -n "${WIDTH}" ] && [ -n "${HEIGHT}" ]; then + VIDEO="${VIDEO},xres=${WIDTH},yres=${HEIGHT}" + else + VIDEO="${VIDEO},xres=${X_RES},yres=${Y_RES}" + fi fi # Allocate VRAM to VGA devices @@ -1354,6 +1358,8 @@ function usage() { echo " --snapshot info : Show disk/snapshot info." echo " --status-quo : Do not commit any changes to disk/snapshot." echo " --viewer : Choose an alternative viewer. @Options: 'spicy' (default), 'remote-viewer', 'none'" + echo " --width : Set VM screen width. Does nothing without --height" + echo " --height : Set VM screen height. Does nothing without --width" echo " --ssh-port : Set ssh-port manually" echo " --spice-port : Set spice-port manually" echo " --public-dir : Expose share directory. @Options: '' (default: xdg-user-dir PUBLICSHARE), '', 'none'" @@ -1491,6 +1497,8 @@ secureboot="off" tpm="off" usb_devices=() viewer="spicy" +width="" +height="" ssh_port="" spice_port="" public_dir="" @@ -1533,6 +1541,8 @@ VMDIR="" VMNAME="" VMPATH="" VIEWER="" +WIDTH="" +HEIGHT="" SSH_PORT="" SPICE_PORT="" MONITOR="" @@ -1651,6 +1661,14 @@ else VIEWER="${2}" shift shift;; + -width|--width) + WIDTH="${2}" + shift; + shift;; + -height|--height) + HEIGHT="${2}" + shift; + shift;; -ssh-port|--ssh-port) SSH_PORT="${2}" shift; @@ -1767,6 +1785,11 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then fi viewer_param_check + if [ -z "${WIDTH}" ] || [ -z "${HEIGHT}" ] ; then + WIDTH="${width}" + HEIGHT="${height}" + fi + # Set the default 3D acceleration. if [ -z "${gl}" ]; then gl="on"