How hard can it be? Well, prepare to be amazed, I've spend days trying to figure out how to turn off screen blanking under linux, and the internet is full of people bewailing the same issue.
I'm working on a job that has a 'management' screen that's permanently displaying information to any passing users. Unfortunately screen blanking keeps kicking in, and as the screen isn't supposed to have a keyboard or mouse, this is proving to be a problem.
The main cause of difficulty is that there are several different systems that can blank the screen. Firstly, there's the linux console, this is the 'text mode' system that's operational even when you're not running a graphical display (you probably knew that).
Once upon a time, this would have been sufficient to turn off screen blanking at the console:
setterm -blank 0
However, modern monitors can powerdown (which old-skool CRT's generally didn't, as in those days fossil fuel resources grew on trees. But then we cut all the trees down). Powering down is different to blanking the screen, it's actually turning the screen off, so you also need to do
setterm -powerdown 0
But there is also 'powersave'. I don't know how this differs from powerdown, but you should also do
setterm -powersave 0
So that's three commands needed for you to be sure that you've switched off screen blanking/turning off in the console alone, before we've even started X.
Incidentally, the 'setterm' command has many interesting features, including the ability to change the color of the screen text and background, take a textmode 'screen dump', turn on blink, underline, reverse, bold, linewrap, the cursor, etc, etc. This means it can be used in shell scripts to output text in different colors or bold or blink.
Now, we start the dreaded 'X', and enter his (yes, 'X' is definitely male) dark cabinet of madness.
X has its own screensaver, that defaults to blanking the screen if no screensaver is set up. You can check the status of this by running the command:
This will print out the status of the various things that 'xset' can mess with. One of them will be:
prefer blanking: yes allow exposures: yes
timeout: 1200 cycle: 600
If timeout is non-zero, then the screen saver will kick in after that many seconds. Turn it off with:
xset s off
But this still isn't the end of it. There's one more thing that can powerdown/blank your screen. It's called 'DPMS', and I think it relates to the monitor's own ability to power itself down independent of the computer using it. If 'xset -q' shows:
DPMS (Energy Star):
Standby: 1200 Suspend: 1800 Off: 2400
DPMS is Enabled
Then again, the monitor is going to go into low-power modes (including 'Off') after the time has elapsed. This final hurdle can be overcome with:
And now, with luck, you should find that your screen doesn't blank. Maybe.