HowTo force screen backlight off when locking screen, general and Xfce4

HowTo force screen backlight off when locking screen, general and Xfce4

Introduction

For months (years?) I have wondered why my ThinkPads fail to turn the backlight off when the screen is locked (blanked).

Solution: xset dpms force off in a Script

Unforunately, I found no way to get the X system to turn the backlight off.

The only way to turn it of is to use xset to switch the screen off.

An according lock script might look like this:

lockscreen.sh
#!/bin/bash   # activate screensaver xscreensaver-command -lock # or: gnome-screensaver-command --lock # or: slock # or: xlock $*   # let the screen fade out sleep 4   # switch the screen off xset dpms force off  

Xfce4 integration

The script solution above has one disadvantage: The script needs to be called. Time based screen locking and Xfce's "lock screen" button won'nt use it.

Fortunately, Xfce4 uses a script anyway, in the first place: /usr/bin/xflock4

One can simple edit this file (as root), and insert the xset call right before the final exit:

End of patched /usr/bin/xflock4
#[...]   # begin of change   # let the screen fade out sleep 4 # switch the screen off xset dpms force off   # end of change   exit 0

Of course this edit has to be re-done after an upgrade that provides a fresh original version of xflock4.