Skip to content

Commit c2d8c96

Browse files
committed
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>
1 parent 7cbc062 commit c2d8c96

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

quickemu

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ function usage() {
22952295
echo " --cpu-pinning : Choose which host cores correspond to which guest cores."
22962296
echo " --delete-disk : Delete the disk image and EFI variables"
22972297
echo " --delete-vm : Delete the entire VM and its configuration"
2298-
echo " --display : Select display backend. 'sdl' (default), 'cocoa', 'gtk', 'none', 'spice' or 'spice-app'"
2298+
echo " --display : Select display backend. 'gtk' (default), 'sdl', 'cocoa', 'none', 'spice' or 'spice-app'"
22992299
echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)"
23002300
echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers"
23012301
echo " --ignore-tsc-warning : Skip TSC stability warning for macOS VMs on AMD"
@@ -2338,6 +2338,14 @@ function display_param_check() {
23382338
usb_controller="xhci"
23392339
fi
23402340

2341+
# Fallback to SDL if GTK display is not available
2342+
if [ "${display}" == "gtk" ]; then
2343+
if ! "${QEMU}" -display help 2>&1 | grep -q "^gtk$"; then
2344+
echo " - NOTE: GTK display not available, falling back to SDL"
2345+
display="sdl"
2346+
fi
2347+
fi
2348+
23412349
if [ "${OS_KERNEL}" == "Darwin" ]; then
23422350
if [ "${display}" != "cocoa" ] && [ "${display}" != "none" ]; then
23432351
echo "ERROR! Requested output '${display}' but only 'cocoa' and 'none' are avalible on macOS."
@@ -2525,7 +2533,7 @@ cpu_cores=""
25252533
disk_format="${disk_format:-qcow2}"
25262534
disk_img="${disk_img:-}"
25272535
disk_size="${disk_size:-16G}"
2528-
display="${display:-sdl}"
2536+
display="${display:-gtk}"
25292537
extra_args="${extra_args:-}"
25302538
fixed_iso=""
25312539
floppy=""

0 commit comments

Comments
 (0)