Random VM Window Resize Behavior

Discussion in 'Linux Virtual Machine' started by parallelso, Sep 1, 2024.

  1. parallelso

    parallelso Junior Member

    Messages:
    21
    There is issue with Parallels 18 and 19 regarding Linux VMs, such as Ubuntu 20/22/24 and Debian 11/12. The Parallels VM window will randomly resize when booting up and shutting down Linux. The VM window size (and Linux display size) is not consistent between sessions, one must repeatedly resize VM window to the desired size. This is not good for daily and regular use of Linux VMs.

    I am looking for solution. I found that one can resize the VM window by changing the Linux display settings. This indicates that the VM window could be resized programically by changing the Linux display settings. A script could be run at login or other time to force the VM window (and Linux display) to have consistent size between sessions.

    Question, do the Parallels developers have a solution for this? Alternatively, what is the command or script to programically change the Linux display size in Ubuntu and Debian? I can use this information to make solution for the random VM window size behavior.

    Thanks
     
  2. parallelso

    parallelso Junior Member

    Messages:
    21
    I figured out a hack that works pretty consistently. It is a bash script that uses the xrandr command to set the display size to one of the standard sizes. Parallels will resize the vm window to accommodate and re-adjust the display size if too large. I tested on Xubuntu 22.04.4. Hopefully this helps others.

    bash script
    --file name;
    change_display_size.sh
    -------------------
    #! /bin/bash

    # to get consistent results
    # first resize linux display to a small size, such as 800x600
    # then resize linux display to a size close to what is desired, such as 1280x800
    # parallels will automaticlly adjust display size to fit if too large
    # resize will last for session or until one resizes vm window;

    # if running at login need to add delay to allow desktop environment setup
    # look at linux display settings to see the corrected display size, such as 1224x768
    sleep 6s
    # echo 'changing display size to smaller size'
    xrandr --output `xrandr | grep " connected"|cut -f1 -d" "` --mode 800x600
    sleep 2s
    # echo 'changing diplay size to target size'
    xrandr --output `xrandr | grep " connected"|cut -f1 -d" "` --mode 1280x800


    -------------------
    --add script to login tasks;
    --go to settings > session and startup > application autostart;
    --add application;
    Name: set_display_size
    Command: sh /home/<username>/set_display_size.sh
    Trigger: on login
    --place script in user home folder;
    --can test by re-login or reboot;
     

Share This Page