Re: [Nix-dev] Automatically locking the screen with xautolock
If you're comfortable having it suid, you could set security.suidPrograms = [ "xautolock" ]; in configuration.nix. Then if xautolock is installed globally it will hopefully work without sudo. On 8 February 2015 at 10: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? > > It's a problem because these lines in configuration.nix: > > displayManager.sessionCommands = > '' > sudo xautolock -time 1 -locker slock & > ''; > > result in > > sudo: no tty present and no askpass program specified > > So it fails to start. > > ___ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev > > ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] Automatically locking the screen with xautolock
Nice! I'm currently binding "gksu 'i3lock -c00 & 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 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 > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] Automatically locking the screen with xautolock
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 nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
[Nix-dev] Automatically locking the screen with xautolock
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? It's a problem because these lines in configuration.nix: displayManager.sessionCommands = '' sudo xautolock -time 1 -locker slock & ''; result in sudo: no tty present and no askpass program specified So it fails to start. signature.asc Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev