Tag/tag.png

Content Cleanup Required
This article should be cleaned-up to follow the content standards in the Wiki Guide. More info...

Tag/tag.png

Style Cleanup Required
This article does not follow the style standards in the Wiki Guide. More info...

vbetool: A Special Use

How to turn off your screen regardless of what you do on the keyboard or mouse

Why?

Well, for several reasons:

  • Because you want to practice and improve your typing skills.
  • Because you need to type important things in a crowed space and you don't want others to see what you’re typing.
  • Because you’re taking notes of your dreams at night and you don’t want the light of the screen to wake you further.
  • Because you like testing weird howtos you happen to stumble upon.

How?

First you have to install the vbetool package.

Now what?

Now you have to do several things. First, vbetool can only be run as root. So you have to add it to the sudoers file as a password-free command.

How?

Here we learn that:

  • As an alternative to editing the /etc/sudoers file, you could add the two lines to a new file in /etc/sudoers.d e.g. /etc/sudoers.d/shutdown. This is an elegant way of separating different changes to the sudo rights and also leaves the original sudoers file untouched for easier upgrades.
    
    Note! Again, you should use the command visudo to edit the file to make sure you do not lock yourself out of the system:
    
    sudo visudo -f /etc/sudoers.d/shutdown 
    
    This also automatically ensures that the owner and permissions of the new file is set correctly.


With that in mind, you now know you need to run on a terminal

  • sudo visudo -f /etc/sudoers.d/vbetool


And you have to add the following to your newly created sudoer file:

  • your_user your_host = (root) NOPASSWD: /usr/sbin/vbetool


Save the file. If everything is ok, you’re almost done.


What next?


Just add the following 2 commands as 2 separate keyboard shortcuts. You can test the commands right away without key binding them, but once you blank your screen you will feel lost and won't know how to turn it back on. There’s a trick though, don’t worry. Keep on reading.

To add a new keyboard shortcut you have to take into account the Ubuntu flavor you're running on your computer. As an example, you can look here on how to add them on Xubuntu. In case of doubt, please read the documentation associated with your distro of choice.

As for the commands, to turn off add as shortcut:

  • sudo vbetool dpms off

And to turn on:

  • sudo vbetool dpms on

You can also try the commands without worry if you know some tricks to get it on. These tricks are important so you are not left out without option to turn the screen back on. They are also important if you make some mistake while adding the shortcuts.

The tricks


There are several ways to revive the screen without issuing vbetool.

  • → The simplest is to just close the lid of your laptop (if you're using one) and to open it again. The screen is now on as usual.
  • → Another one is to add the following command as a shortcut and use it while the screen is off.
  • xset dpms force off

    If you then type or use your mouse, the screen will turn on as it is supposed to.

  • → And as a last resort you can suspend your computer. When you wake it up, the screen will be back on again.


CategoryAccessories

vbetool (last edited 2017-09-06 22:08:18 by ckimes)