source: utmapp/UTM#4064 (comment)
Hi, just adding a more elegant way of making dynamic resolution. We gonna just use the udev event for that.
YOU MUST have installed :
sudo systemctl start spice-vdagent
sudo systemctl enable spice-vdagent
Here is my config files for the udev rule :
sudo cat /etc/udev/rules.d/10-resize.rules
ACTION=="change",KERNEL=="card0", SUBSYSTEM=="drm", RUN+="/usr/local/bin/resize"
Now the script it trigger :
sudo cat /usr/local/bin/resize
#! /bin/sh
PATH=/usr/bin
desktopuser=$(/bin/ps -ef | /bin/grep -oP '^\w+ (?=.*vdagent( |$))') || exit 0
export DISPLAY=:0
export XAUTHORITY=$(eval echo "~$desktopuser")/.Xauthority
xrandr --output "$(xrandr | awk '{if($0 ~/ connected/){print $1}}')" --auto
The script take account of the possibility that the monitor is not named Virtual-1
I can confirm that's not an issue from UTM because i apply similar workaround for almost every Kali install i do. And it is also a bug that have been signaled for years without any real fix.