Edit: I have just realized, the same resizing happens if I maximize a window and then restore it, but only in nautilus, and not in evince/gedit.
Ever since I started using Bionic, I've had the following issue with two desktops connected to HiDPI monitors (3840x2160), at work and at home: if I lock the screen and step away for some time, when I get back some windows are resized/shrinked.
Subsequent lock and login cycles shrink the windows further, so that if I'd forgotten an open folder in the morning, by next day Nautilus opens by default to a really small window.
I did some Googling (Ask Ubuntu Question 1, Ask Ubuntu Question 2, Ask Ubuntu Answer, Launchpad bug) and it seems like maybe the culprit is the fact that I use 200% scaling and the login screen. But nothing I tried solved the issue. Is there anything I can do to debug this issue further?
I tried the solutions in Ask Ubuntu Question 1, to set Gnome's automatic window scaling the match what I use by:
$ gsettings set org.gnome.desktop.interface scaling-factor 2
but that didn't work.
I also tried to scale
gdm3's login screen so that it matches my desktop as described in Ask Ubuntu Question 2, by editing
/usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml so that the
scaling-factor key reads:
<key name="scaling-factor" type="u"> <default>2</default> <summary>Window scaling factor</summary> <description> Integer factor used to scale windows by. For use on high-dpi screens. 0 means pick automatically based on monitor. </description> </key>
and like the second answer suggested creating
/usr/share/glib-2.0/schemas/93_hidpi.gschema.override with content
$ sudo glib-compile-schemas /usr/share/glib-2.0/schemas
and that didn't work either.
Finally, trying to make sure
gdm3's login screen uses the same resolution as my desktop, I followed this Ask Ubuntu Answer and ran
$ sudo cp -i .config/monitors.xml /var/lib/gdm3/.config/ $ sudo dpkg-reconfigure gdm3
still, no joy. (I'll paste my
monitors.xml below, just in case that could help.)
<monitors version="2"> <configuration> <logicalmonitor> <x>0</x> <y>0</y> <scale>2</scale> <primary>yes</primary> <monitor> <monitorspec> <connector>DP-2</connector> <vendor>DEL</vendor> <product>DELL S2817Q</product> <serial>J42MC89E181I</serial> </monitorspec> <mode> <width>3840</width> <height>2160</height> <rate>59.997123718261719</rate> </mode> </monitor> </logicalmonitor> </configuration> </monitors>