8

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
awful.key(
    { "Mod1", "Control" },
    "l",
    function ()
        awful.util.spawn("gnome-screensaver-command --lock")
    end)

How do I solve point 3?

l0b0
  • 50,672
  • 41
  • 197
  • 360

2 Answers2

6

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.

l0b0
  • 50,672
  • 41
  • 197
  • 360
jasonwryan
  • 71,734
  • 34
  • 193
  • 226
  • 1
    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 03 '12 at 01: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 03 '12 at 02:36
  • VLC 2.1.5 works fine with `xautolock` – l0b0 Aug 12 '14 at 19:55
0

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

http://rabexc.org/posts/awesome-xautolock-battery

rabexc
  • 111
  • 2
  • 2
    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