Page 1 of 1

know a command-line for turning off the screen ? [SOLVED]

Posted: Thu Jul 30, 2020 6:11 pm
by NimbUx
Do we have a command - in Terminal under Raspi-OS desktop - for turning off the display, immediately,
and preferably so it does not turn on by itself on detecting mouse movement (unlike the regular screen saver) ?

Re: know a command-line for turning off the screen ?

Posted: Fri Jul 31, 2020 2:56 pm
by bjtheone
The following will blank the screen:

Code: Select all

sleep 1 ; xset dpms force off
DPMS is Display Power Management Signaling, a standard to reduce power consumption in monitors. xset is of course an X utility. If you need to accomplish this without X involved, use setterm:

setterm -powerdown 1

The full list of options to manipulate your screen:

xset -dpms # Disable DPMS
xset +dpms # Enable DPMS
xset s off # Disable screen blanking
xset s 150 # Blank the screen after 150 seconds
xset dpms 300 600 900 # Set standby, suspend, & off times (in seconds)
xset dpms force standby # Immediately go into standby mode
xset dpms force suspend # Immediately go into suspend mode
xset dpms force off # Immediately turn off the monitor
xset -q # Query current settings

setterm -blank 10 # Blank the screen in 10 minutes
setterm -powersave on # Put the monitor into VESA power saving mode
setterm -powerdown 20 # Set the VESA powerdown to 20 minutes

Re: know a command-line for turning off the screen ?

Posted: Fri Jul 31, 2020 3:00 pm
by GlowInTheDark
Which of course begs the obvious question:

How to get it back?

Note that this may be related to my recent adventure with "dm-tool lock" - where it seems to just brute force turned off the screen(s). Maybe DPMS would have a way to recover from that?

Re: know a command-line for turning off the screen ?

Posted: Fri Jul 31, 2020 4:33 pm
by NimbUx
bjtheone wrote:
Fri Jul 31, 2020 2:56 pm
The following will blank the screen:

Code: Select all

sleep 1 ; xset dpms force off
Thanks ! That, in Terminal at the Desktop,
does the job : turn off the screen.

It comes back on at a key press OR by moving the mouse though. I had rather
avoided the latter (because mice often are over-sensitive creatures...)
but it's fine anyway. Oooops ! Rejoiced too soon, the command does blank the
screen but it eventually comes back after an unpredictable time, without touching
the mouse and/or keyboard :=(

Not tried the other variants and propositions.

Re: know a command-line for turning off the screen ?

Posted: Sat Aug 01, 2020 10:23 am
by sparkie777
turn off console:

Code: Select all

tvservice -o
turn on again:

Code: Select all

tvservice -p
I don't use X11 on RPi. So I can't tell how these commands interact with X11.

SOLVED: a command-line for turning off the screen

Posted: Sat Aug 01, 2020 11:14 am
by NimbUx
sparkie777 wrote:
Sat Aug 01, 2020 10:23 am

Code: Select all

tvservice -o
... 
tvservice -p
I don't use X11 on RPi. So I can't tell how these commands interact with X11.
I just tried, in the GUI (X) : both commands worked, but after the resume, my Desktop's XY dimensions
were not restored properly, displayed GUI is shrinked, anchored at the left high corner of
the physical screen.

Maybe related to having Linux set to display, normally, to a resolution (1600x900) that
is not my screen's native one (viz 1920x1080)

Now I need another command to expand, inflate the picture again to fill the screen :=).
Have to dig this question more...
{Edit:} solved ! giving the solution out for anybody also scratching his(her) head :
Lookup xrandr ! Example, in my case this command (in Terminal) :

Code: Select all

$ xrandr --output HDMI-1 --mode 1600x900
will restore my regular display mode (which is not the screen's preferred mode)