Michaela Merz's personal blog site

Getting Monitors To Sleep

I recently “upgraded” to CentOS 7 and got a Radeon RX 480 graphics card to go along with the upgrade. Everything went well but a nagging problem needed special care.

I am running the “Cinnamon” desktop on a multi-monitor (3) setup. This in itself required .. let’ say “unique” .. configuration steps but I was finally able to get the monitors configured correctly.  But one problem remained: I couldn’t get the monitors to sleep. Not just to turn the brightness down – I wanted to get the monitors off. As in no backlight.

Usually that can be achieved with something as simple as

xset dpms force off

Just type it into a console and your monitors go blank. And yes .. that worked for me. For about ten seconds after they switched on again. No – I didn’t touch the mouse, I even ran a cron script to make sure. The screens go off .. only to switch back on after about 10 seconds.

Ahh .. the multiple advantages of modern “smart” technology. The kind of technology that fails to solve problems it created in the first place. The “culprit” is “xrandr – the X Window configuration tool that is used to set the size, orientation or reflection of the outputs for one or multihead screens.

The idea behind it is somewhat logical – the X Window system and your Desktop are automatically adapting to the numbers of monitors connected – and change dynamically if you add or remove a monitor. While this makes sense on a laptop – it’s not really useful on hardwired servers or work stations.

Whenever the screensaver or a typed command forces the monitor offline it also triggers a

uh .. oh  .. something changed on the bus I must re-scan … 

background process – the monitors are getting probed, the Desktop feels obligated to adjust and the monitors are switched on again  and well .. there you go.

It took me the better part of an evening to learn everything about the interactions of xrandr, the X Window environment, udev, the Desktop and .. of course systemd. Each and every one of those services has a role in this game.

To make thinks easier.

Anyway .. there is a way that breaks the interaction.

gsettings set org.cinnamon.settings-daemon.plugins.xrandr active false

breaks the chain between the monitor status change recognition and the Desktop (cinnamon). Putting this command before

xset dpms force standby;

turns off your monitors. However – whatever happens from now on – it will no longer be  reported to the Desktop. In other words – you need to re-activate “plugins.xrandr” before you are able to use the Desktop again.

I didn’t go into making the modification into the “screen saver” environment but used xbindkeys to map a key on the keyboard to switch the screens off and on. I am sure there are better ways to get this incorporated into the Desktop environment, but I am happy how it is now.






Leave a Reply

Your email address will not be published. Required fields are marked *