LG-43SQ700S-W DPMS Wake

I got myself a brand new 43 inches monitor, it’s amazing, the visual comfort is life changing.
It all worked pretty much immediately except one little annoying thing: 9 times out of 10, when putting the monitor to sleep with xset dpms force off and waking it up by hitting a key, it would not detect the HDMI signal for about the 30 longest seconds ever.

I finally found that if I change from X11 to the console (Ctrl-Alt-F1 then Ctrl-Alt-F7), it would detect the signal instantly. I suspected that a simple resolution change would do the trick, but changing resolution would also mess the windows positions. Fortunately, here’s what xrandr saw:

   3840x2160     60.00*+  59.94    50.00    29.97    25.00    23.98
   4096x2160     59.94    50.00    29.97    25.00    24.00    23.98
   2560x1440     59.95
   1920x1080     60.00    59.94    50.00    29.97    25.00    23.98
   1280x1024     60.02
   1280x720      59.94    50.00
   1152x864      60.00
   1024x768      60.00
   800x600       60.32
   720x576       50.00
   720x480       59.94
   640x480       59.95    59.94

There’s a 59.94 frequency for the resolution I use (3840x2160), so I came up with this tiny trick:

#!/bin/sh
sleep 0.5
xrandr --output HDMI-0 --mode 3840x2160 --rate 59.94
sleep 0.2
xrandr --output HDMI-0 --mode 3840x2160 --rate 60.00

Which I mapped to the totally unused (at least by me) Print-Screen key.