1

Intending to switch off the display/monitor/screen instantly (and only be reenabled upon keypress) I resort to this solution:

  • a /bin/blankvt script:

    #!/bin/sh
    
    echo 1 > /sys/devices/pci0000:00/0000:00:02.0/graphics/fb0/blank
    read keypress
    chvt 2
    
  • a /bin/blank script:

    #!/bin/sh
    
    openvt -s -f -c 40 /bin/blankvt
    

Having setup this I can simply call blank on the command line and the screen will go off and energy is saved. Great!

While this solution works right now, it appears hackish and brittle and what I seek is the correct way to achieve the same effect. Typing blank at the shell prompt should result in the screen to be turned off.

My question hence: how can I switch of the monitor "correctly"?

Background/Motivation

I am not connected to the electrical grid, conserving energy is paramount to me. I need to have the laptop/PC do some calculations but would desire to turn off the superflous energy consumption by the display (which seems a non neglectible consumer anyway).

Best if I could achieve this within:

  • GNOME Shell 3.32.2.
  • Linux 5.xx
2

If you’re using X,

xset dpms force off

will switch the display off.

Under Wayland with GNOME, you can activate the screensaver, which will blank the screen if it’s configured to do so normally:

dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call \
          /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:true

You can also lock your session with MetaL, which will have the same effect if your session is configured to blank the screen when the screensaver is on.

  • thanks for providing solutions for both wayland and Xserver. I makes me realize that I sort of forgot to clarify wich display server/protocol I use. But I guess that makes the answer even better it provides for both Xorg and Wayland. I use mostly wayland. And the dbus thing worked like a charm! thanks – humanityANDpeace Jul 11 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.