Thursday, March 28, 2013
3:04 PM

Turning the screen blank from command line

Screensavers are used to cover the desktop with some images or graphics while we are away from the system.

Here is how we can enable the screen saver from the command line. The screen saver from the command line will basically turn the screen blank and turn it on again only on detecting a user activity or when the command to turn off the screen saver is sent.

The first step to activate screensaver from the command line is the start the screensaver using the command



After the command has been executed we can activate the screensaver using the command



As soon as the command is executed the screen turns blank and comes back to life on any press of key or mouse movement.
Note that after being activated it will prompt for the user password before displaying the desktop.

We can also simulate a user activity from command line by passing the option "-p" to the command gnome-screensaver-command, which is equivalent to poking the screensaver like a user.

Thus to make the screen blank for 5 minutes we do



The above set of command will make the screen blank for 5 seconds and then reactivate the screen after 5 seconds.
To prevent from being prompted for password on activation of the screen, we can use the option -d instead of -p, which is to deactivate the screensaver.

We can create a script with the above commands, as required, and add it to the panel as a quick launcher, to give us the facility of quickly blanking the screen whenever required.


0 comments:

Post a Comment