feat(quickemu): prefer GTK display backend and add GTK->SDL fallback

- Set default --display to 'gtk' instead of 'sdl'
- Add runtime check to fall back to 'sdl' when QEMU lacks GTK support
  and print a note to the user
- Update usage text to show 'gtk' as the default display option

Signed-off-by: Martin Wimpress <martin@wimpress.org>
This commit is contained in:
Martin Wimpress 2026-01-27 19:39:15 +00:00 committed by Martin Wimpress
parent 7cbc062a57
commit c2d8c96074
1 changed files with 10 additions and 2 deletions

View File

@ -2295,7 +2295,7 @@ function usage() {
echo " --cpu-pinning : Choose which host cores correspond to which guest cores." echo " --cpu-pinning : Choose which host cores correspond to which guest cores."
echo " --delete-disk : Delete the disk image and EFI variables" echo " --delete-disk : Delete the disk image and EFI variables"
echo " --delete-vm : Delete the entire VM and its configuration" echo " --delete-vm : Delete the entire VM and its configuration"
echo " --display : Select display backend. 'sdl' (default), 'cocoa', 'gtk', 'none', 'spice' or 'spice-app'" echo " --display : Select display backend. 'gtk' (default), 'sdl', 'cocoa', 'none', 'spice' or 'spice-app'"
echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)" echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)"
echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers" echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers"
echo " --ignore-tsc-warning : Skip TSC stability warning for macOS VMs on AMD" echo " --ignore-tsc-warning : Skip TSC stability warning for macOS VMs on AMD"
@ -2338,6 +2338,14 @@ function display_param_check() {
usb_controller="xhci" usb_controller="xhci"
fi fi
# Fallback to SDL if GTK display is not available
if [ "${display}" == "gtk" ]; then
if ! "${QEMU}" -display help 2>&1 | grep -q "^gtk$"; then
echo " - NOTE: GTK display not available, falling back to SDL"
display="sdl"
fi
fi
if [ "${OS_KERNEL}" == "Darwin" ]; then if [ "${OS_KERNEL}" == "Darwin" ]; then
if [ "${display}" != "cocoa" ] && [ "${display}" != "none" ]; then if [ "${display}" != "cocoa" ] && [ "${display}" != "none" ]; then
echo "ERROR! Requested output '${display}' but only 'cocoa' and 'none' are avalible on macOS." echo "ERROR! Requested output '${display}' but only 'cocoa' and 'none' are avalible on macOS."
@ -2525,7 +2533,7 @@ cpu_cores=""
disk_format="${disk_format:-qcow2}" disk_format="${disk_format:-qcow2}"
disk_img="${disk_img:-}" disk_img="${disk_img:-}"
disk_size="${disk_size:-16G}" disk_size="${disk_size:-16G}"
display="${display:-sdl}" display="${display:-gtk}"
extra_args="${extra_args:-}" extra_args="${extra_args:-}"
fixed_iso="" fixed_iso=""
floppy="" floppy=""