Comment 23 for bug 1971434

Revision history for this message
Richard Brown (hypromangt) wrote (last edit ):

I have the same issue, migrating from 20.04 to 22.04.1 (worked fine on 20.04)
Asus N56VM laptop with a GeForce GT 630M

"xset dpms force off" will turn the display off properly.

Unfortunately, the cron approach described in #22 doesn't work on my system; when the screen blanks after inactivity, xset -q still reports that the "Monitor is On".

[edit: appended]
I came up with another hack/workaround that does work on my machine. The idea is to read the Settings->Power->"Screen Blank" idle timeout value from Gnome and use it to sync the DPMS timeout value using xset. I have this script running periodically via cron:

---- code snippet START ----
#!/usr/bin/env bash

IDLE_MINUTES=$(gsettings get org.gnome.desktop.session idle-delay | cut -d ' ' -f2)
X11_DISPLAY=:1
if [ -e "${HOME}/.X11_display" ]; then
    X11_DISPLAY=$(cat "$HOME/.X11_display")
fi
DISPLAY=${X11_DISPLAY} xset dpms 0 0 $IDLE_MINUTES
---- code snippet END ----

Setting DISPLAY is needed; otherwise xset can't interact with the X server. To achieve this, I've added the following code to my ~/.bashrc file:

---- code snippet START ----
# Record the X11 DISPLAY value if available
if [[ -n "${DISPLAY}" ]] && [[ ${DISPLAY} =~ ^:.* ]]; then
    echo "${DISPLAY}" > "${HOME}/.X11_display"
fi
---- code snippet END ----

Not perfect by any stretch, but better than a dark + backlit LCD screen.