[Nix-dev] Automatically locking the screen with xautolock
Michael Alyn Miller
malyn at strangeGizmo.com
Sun Feb 8 20:08:52 CET 2015
The 02/08/2015 21:07, Nikita Karetnikov wrote:
> How do I automatically lock the screen in NixOS? I've installed
> xautolock and slock. And tested
>
> sudo xautolock -time 1 -locker slock
>
> in the shell, which works fine. Can I make it work without
> sudo?
I use xss-lock, which I recently added to Nixpkgs. I start
xss-lock from .i3/config, but presumably it would work in
displayManager.sessionCommands as well. xss-lock uses xset to
to both configure the screensaver delay as well as to manually
start the screensaver (if you want to activate the screensaver
with a hotkey, for example).
One of my favorite features of xss-lock is that it knows about
suspend/resume and will automatically lock the screen on resume.
Here is the relevant section from my .i3/config file:
# Win+L locks the screen.
bindsym Mod4+l exec xset s activate
# Start xss-lock (and lock the screen after 15 minutes)
exec_always xset s 900
exec_always --no-startup-id xss-lock -- i3lock -n -i $HOME/example.png
Let me know if you need any additional information.
Thanks,
Michael Alyn Miller
More information about the nix-dev
mailing list