Fix 'X11 connection broke' issue in QT based GUI applications like VLC

Fix it by setting QT_AUTO_SCREEN_SCALE_FACTOR env var

troublesome VLC
troublesome VLC

If you ever encountered error like this when starting vlc:

$ vlc
VLC media player 3.0.0-rc5 Vetinari (revision 3.0.0-rc5-0-gf53236af09)
[0000560cfbe38410] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
The X11 connection broke: Maximum allowed requested length exceeded (code 4)
XIO:  fatal IO error 22 (Invalid argument) on X server ":0"
      after 447 requests (447 known processed) with 0 events remaining.
QMutex: destroying locked mutex

Then you can fix it by setting the QT_AUTO_SCREEN_SCALE_FACTOR env variable to 0, i.e.:

QT_AUTO_SCREEN_SCALE_FACTOR=0 vlc your_video_file.mkv

You can also modify the .desktop file so that this variable is always set, when you start the application via e.g. apps menu: In /usr/share/applications/vlc.desktop replace:

Exec=/usr/bin/vlc --started-from-file %U

with:

Exec=env QT_AUTO_SCREEN_SCALE_FACTOR=0 /usr/bin/vlc --started-from-file %U

and Bob’s your uncle.