Nice! I'm currently binding "gksu 'i3lock -c000000 & pm-suspend'" to a hotkey using i3, but this is better. Is there a standard way to get it in my fork of nixpkgs, which is tracking the release-14.12 branch? (I could just copy and paste but if there's a better way now would be a good time to learn.) Jeff
On Sun, 8 Feb 2015 11:08:52 -0800 Michael Alyn Miller <[email protected]> wrote: > 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 > _______________________________________________ > nix-dev mailing list > [email protected] > http://lists.science.uu.nl/mailman/listinfo/nix-dev _______________________________________________ nix-dev mailing list [email protected] http://lists.science.uu.nl/mailman/listinfo/nix-dev
