diff --git a/quickemu b/quickemu index 2c02335..f86b7df 100755 --- a/quickemu +++ b/quickemu @@ -727,45 +727,14 @@ function vm_boot() { esac # Determine a sane resolution for Linux guests. - if [ "${guest_os}" == "linux" ]; then - local X_RES=1152 - local Y_RES=648 - - # If the user has specified a resolution, use that via config or command line. - if [ -n "${WIDTH}" ] && [ -n "${HEIGHT}" ]; then - X_RES="${WIDTH}" - Y_RES="${HEIGHT}" - elif [ "${XDG_SESSION_TYPE}" == "x11" ] || [ "${XDG_SESSION_TYPE}" == "wayland" ]; then - if [ -z "${SCREEN}" ]; then - X_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1) - Y_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | sort | head -n1) - else - X_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f1 | head -n1) - Y_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | head -n1) - fi - - if [ "${FULLSCREEN}" ]; then - : - elif [ "${SCREENPCT}" ] ; then - X_RES=$(( X_RES*SCREENPCT/100 )) - Y_RES=$(( Y_RES*SCREENPCT/100 )) - elif [ "${X_RES}" -ge 3840 ]; then - X_RES=3200 - Y_RES=1800 - elif [ "${X_RES}" -ge 2560 ]; then - X_RES=2048 - Y_RES=1152 - elif [ "${X_RES}" -ge 1920 ]; then - X_RES=1664 - Y_RES=936 - elif [ "${X_RES}" -ge 1280 ]; then - X_RES=1152 - Y_RES=648 - else - : - fi + #if [ "${guest_os}" == "linux" ]; then + local X_RES="1280" + local Y_RES="800" + if [ -n "${width}" ] && [ -n "${height}" ]; then + local X_RES="${width}" + local Y_RES="${height}" fi - fi + #fi # https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/ if [ "${guest_os}" == "linux_old" ]; then @@ -1431,8 +1400,6 @@ function usage() { echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers" echo " --kill : Kill the VM process if it is running" echo " --offline : Override all network settings and start the VM offline" - echo " --screen : Use specified screen to determine the window size." - echo " --screenpct : Percent of fullscreen for VM if --fullscreen is not specified." echo " --shortcut : Create a desktop shortcut" echo " --snapshot apply : Apply/restore a snapshot." echo " --snapshot create : Create a snapshot." @@ -1440,8 +1407,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 " --width : Set VM screen width; requires '--height'" + echo " --height : Set VM screen height; requires '--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'" @@ -1581,8 +1548,8 @@ secureboot="off" tpm="off" usb_devices=() viewer="spicy" -width="" -height="" +width="${width:-}" +height="${height:-}" ssh_port="" spice_port="" public_dir="" @@ -1613,8 +1580,6 @@ OUTPUT="" PUBLIC="" PUBLIC_PERMS="" PUBLIC_TAG="" -SCREEN="" -SCREENPCT="" SHORTCUT=0 SNAPSHOT_ACTION="" SNAPSHOT_TAG="" @@ -1625,8 +1590,6 @@ VMDIR="" VMNAME="" VMPATH="" VIEWER="" -WIDTH="" -HEIGHT="" SSH_PORT="" SPICE_PORT="" MONITOR="" @@ -1702,24 +1665,6 @@ else -offline|--offline) network="none" shift;; - -screen|--screen) - SCREEN="${2}" - shift - shift;; - -screenpct|--screenpct) - if [ -n "${2##*[!0-9]*}" ] ; then - if [[ ${2} -ge 25 && ${2} -lt 100 ]] ; then - SCREENPCT=${2} - else - echo "screenpct invalid must be 25 <= pct < 100" - usage - fi - else - echo "screenpct needs to be an integer in range 25 <= pct < 100" - usage - fi - shift - shift;; -snapshot|--snapshot) SNAPSHOT_ACTION="${2}" if [ -z "${SNAPSHOT_ACTION}" ]; then @@ -1749,11 +1694,11 @@ else shift shift;; -width|--width) - WIDTH="${2}" + width="${2}" shift; shift;; -height|--height) - HEIGHT="${2}" + height="${2}" shift; shift;; -ssh-port|--ssh-port) @@ -1877,11 +1822,6 @@ 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 if command -v glxinfo &>/dev/null; then