Raspberry Pi 2, noobs GUI, powered J5create HDMI adaptor going to an old GatewayFPD1750.
The Xorg server blanks the screen after about 10 minutes. I can mess with that timing as described here: Disable screen blanking in X-Windows on Raspbian
Trouble is, after a couple hours of unuse, pressing a key, or moving mouse is no longer enough to bring up the GUI display. If I log in via screen sharing, I can see the mouse move, and letters being typed, the display just doesn't wake. Disconnecting wifi dongle and kybd or mouse does not fix the issue, nor does using a powered USB hub. Unplugging and replugging the HDMI plug does wake the screen, but that's annoying, and what with surface mount there's really no way to solder a switch in there.
However, this pair of terminal commands, entered via the screenshare, will bring back the GUI desktop display for me:
tvservice -p #(power on hdmi w preferred settings) xset dpms force on #(turn on HDMI for window server)
Having gotten that far, the question remains: Into which file do I place these commands so that they are always executed when the screen is blank and a key is pressed?