Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Day to day I'm seeing many questions which say:

  • Screensaver/lock doesn't work.

  • Screensaver doesn't require password after waking or doesn't lock the screen.

  • Can not exit screensaver / nothing works after pressing key or moving mouse.

  • and many many more not specific with gnome-screensaver only but also with xscreensaver.

So how to make a simple, fast and lightweight screensaver which locks the screen after given time and requires the password in order to continue?

In addition to my answer, I request to others who have other answer to share here.. :)

share|improve this question
add comment

2 Answers

A tutorial to build a custom screen-lock

  1. Install two packages by executing following commands:

    sudo apt-get install xautolock xlockmore
    
  2. Once installed enable xlock daemon on every time system starts by adding the entry to Startup Applications. Following steps will help:

    • Open Startup Applications:

    image1

    • Click Add button to open Add Startup Program window.

      Then fill with xautolock -time 10 in Command text-box. It will lock the screen after every 10 minutes if the system is being idle for 10 minutes. 10 can be replaced by any natural number. Click Add and then finally Close. Following screen will help:

    image2

  3. That's it. A simple screen-lock is ready! :) Login and Logout to check whether it is working or not.

  4. To stop the xlock daemon i,e if don't want to lock the screen any more type followng command in terminal:

    xautolock -exit
    

    also remove the command under Starup Applications. Get more options and help by: man xautolock and man xlock.

Usage

Working can be checked by executing following command if above two packages are installed:

xautolock -time 1

If left idle for 1 minute the system will be locked. Actually the command runs the executes the xlock daemon which locks the system.

Feel free to edit it to make it more clear and interactive. Any types of comments and suggestions are most welcome.

Thank You!!

share|improve this answer
    
Why a down-vote? It is tested and working nice!! If someone get any problem, I request to post it in comment. So that I'll try to solve the problem. Some people are so mean here. :( –  Saur.K Oct 25 '13 at 19:06
add comment

If you just want a very simple screenlocker, try slock:

http://tools.suckless.org/slock

It's a pure screen locker though, no screensaver functionality. But the code is kept very simple (just 300 LOC) so you should experience no bugs.

To launch slock automatically after a timeout, use xautolock as Saurav suggested.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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