Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got an Ubuntu 12.04 system with Awesome WM, and I'd like the screensaver to work like in Unity:

  1. GNOME Screensaver
  2. Ctrl-Alt-L to lock
  3. N minutes' timeout which respects applications which temporarily disable the screensaver

The keyboard shortcut was relatively easy:

-- Lock screen
    { "Mod1", "Control" },
    function ()
        awful.util.spawn("gnome-screensaver-command --lock")

How do I solve point 3?

share|improve this question
up vote 6 down vote accepted

You could use xautolock:

Xautolock monitors console activity under the X window system, and fires up a program of your choice if nothing happens during a user configurable period of time. You can use this to automatically start up a screen locker in case you tend to forget to do so manually before having a coffee break.

Something along the lines of:

xautolock -time 10 -locker "gnome-screensaver-command --lock"

The only application that I have found that doesn't respect xautolock is VLC; but mplayer works nicely with it.

share|improve this answer
Are you sure mplayer works nicely? I'm currently using mplayer-1.1(svn) and xautolock still triggers the locker while playing a video. – Unode Dec 3 '12 at 1:27
At the time I wrote this answer, yes mplayer worked with xautolock. An update sometime since has meant this is no longer the case. Hopefully, it is a temporary aberration. – jasonwryan Dec 3 '12 at 2:36
VLC 2.1.5 works fine with xautolock – l0b0 Aug 12 '14 at 19:55

This is a fairly old post - but there's a good explanation on how to use xautolock together with i3lock here:


share|improve this answer
It is often customary to paste some of the important information from a link inline. You may want to consider doing so. – HalosGhost Jun 24 '14 at 17:32

Your Answer


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.