Preventing window resizing after resume

I have a laptop with high DPI display (HiDPI). I use scaling factor 100%, but login and lock screen of GDM uses 200 % because of auto detection. This is the second error concerning GDM and HiDPI displays. After unlock my system (here Manjaro) I got the following screen:

Then I had to minimize and restore the window to get a correctly rendered window.

The solution is to set the scaling factor in GDM to the same as in your user session. You can check the current setting with:

gsettings get org.gnome.desktop.interface scaling-factor

0 means auto scaling, 1 means 100%, 2 means 200% and so on.

So you can change this value from auto detection to a static value, in my case 1 for 100% scaling factor:

gsettings set org.gnome.desktop.interface scaling-factor 1

Modify screen resolution or dpi in display manager like gdm or lightdm

If you have a screen with a large resolution (for example 4k) or you have a high DPI (HiDPI) screen, you will know that the display manager uses a lower resolution or a wrong DPI setting.

The solution is very easy. As gdm or lightdm also have a normal user account with normal home directory. So you can just copy your correct monitors.xml to the home directory of your display manager. For gdm this would be:

sudo mkdir -p ~gdm/.config
sudo chown gdm:gdm ~gdm/.config
sudo cp -a  ~/.config/monitors.xml ~gdm/.config/
sudo chown gdm:gdm ~gdm/.config/monitors.xml

After reboot you will see the correct screen resolution.

This is especially useful on HiDPI changes, because GNOME Shell in Manjaro (ArchLinux) makes all windows small on screen lock, so that you have to resize them after relogin.