Merge branch 'add-fullscreen-option'

This commit is contained in:
evereux 2020-04-18 16:10:13 +01:00
commit c3e5a8e4e5
2 changed files with 13 additions and 4 deletions

View File

@ -267,6 +267,7 @@ You can also pass optional parameters
--snapshot delete <tag> : Delete a snapshot.
--snapshot info : Show disk/snapshot info.
--status-quo : Do not commit any changes to disk/snapshot.
--fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)"
```
## TODO

View File

@ -311,7 +311,10 @@ function vm_boot() {
local Y_RES=648
if [ "${XDG_SESSION_TYPE}" == "x11" ]; then
local LOWEST_WIDTH=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1)
if [ ${LOWEST_WIDTH} -ge 3840 ]; then
if [ ${FULLSCREEN} ]; 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)
elif [ ${LOWEST_WIDTH} -ge 3840 ]; then
X_RES=3200
Y_RES=1800
elif [ ${LOWEST_WIDTH} -ge 2560 ]; then
@ -335,11 +338,11 @@ function vm_boot() {
fi
if [ "${DISPLAY_DEVICE}" == "qxl-vga" ]; then
VIDEO="-device ${DISPLAY_DEVICE},xres=${X_RES},yres=${Y_RES}"
VIDEO="-device ${DISPLAY_DEVICE},xres=${X_RES},yres=${Y_RES}, ${FULLSCREEN}"
elif [ "${DISPLAY_DEVICE}" == "virtio-vga" ]; then
VIDEO="-device ${DISPLAY_DEVICE},virgl=${VIRGL},xres=${X_RES},yres=${Y_RES}"
VIDEO="-device ${DISPLAY_DEVICE},virgl=${VIRGL},xres=${X_RES},yres=${Y_RES}, ${FULLSCREEN}"
else
VIDEO="-device VGA,vgamem_mb=128,xres=${X_RES},yres=${Y_RES}"
VIDEO="-device VGA,vgamem_mb=128,xres=${X_RES},yres=${Y_RES}, ${FULLSCREEN}"
fi
echo " - Video: ${DISPLAY_DEVICE}"
@ -507,6 +510,7 @@ function usage() {
echo " --snapshot delete <tag> : Delete a snapshot."
echo " --snapshot info : Show disk/snapshot info."
echo " --status-quo : Do not commit any changes to disk/snapshot."
echo " --fullscreen : Starts VM in full screen mode"
exit 1
}
@ -522,6 +526,7 @@ usb_devices=()
ram=""
cpu_cores=""
FULLSCREEN=""
DELETE=0
ENABLE_EFI=0
SNAPSHOT_ACTION=""
@ -559,6 +564,9 @@ while [ $# -gt 0 ]; do
-status-quo|--status-quo)
STATUS_QUO="-snapshot"
shift;;
-fullscreen|--fullscreen)
FULLSCREEN="--full-screen"
shift;;
-vm|--vm)
VM="${2}"
shift