+++
title = "automatic locking of the screen"
date = "2012-08-03T12:39:11+00:00"
author = "Gibheer"
draft = false
+++

After I switched everywhere to a tiling wm, I wondered how everybody else locks his screen. Sure, you can lock the screen with a keybinding, but what when you leave the pc for talking and then leave it be?

The tool I found is [xautolock][xautolock] and works pretty good. After a configurable time span it starts the lock and after another time it can also start suspend, hibernate or whatever. I use it with the following settings:

  xautolock -locker slock -time 2 -killer "systemctl suspend" -killtime 10 &

This starts slock, the simple locker, after two minutes and sends the pc into suspend after 10 minutes in activity. As it runs in the background, you can either start it through .xinitrc or with your wm of choice.

To lock the screen by command, bind `xautolock -locknow` to your keys and it calls the deamon which then calls the locker.

[xautolock]: http://freecode.com/projects/xautolock
