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;
     
  3. MitchellS7

    MitchellS7

    Messages:
    1
    It seems you're experiencing an issue with inconsistent VM window sizes in Parallels 18/19 when using Linux VMs like Ubuntu or Debian. While Parallels developers might not have a direct solution yet, you can indeed force a consistent window size by using a script to adjust the display settings automatically on login.

    For Ubuntu/Debian, you can use the xrandr command to set a specific resolution. Here's an example script:

    bash
    #!/bin/bash
    xrandr --output [your-display-output] --mode [desired-resolution]

    Replace [your-display-output] with your display's name (you can find this by running xrandr without arguments) and [desired-resolution] with the resolution you want, such as 1920x1080.

    Save this script, make it executable, and add it to your startup applications in Linux to run on login. This should help ensure your VM window size remains consistent between sessions.

    Hopefully, Parallels will address this issue soon!
     
    Last edited by a moderator: Oct 13, 2024

Share This Page