feat(tazjin/tverskoy): Enable automatic screen locking
Defines a small helper script that resets the keyboard layout (to avoid getting stuck in Russian layout) and locks the screen via xsecurelock, and configures home-manager to launch this automatically. Fascinatingly this actually seems to be capable of locking the screen *on suspend*, not *after suspend*. Change-Id: Ib6279a445aba18c2fb5bc073b675e6e2598fa228 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2644 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
parent
4daa4c1923
commit
4057634a7a
1 changed files with 19 additions and 0 deletions
|
@ -16,6 +16,15 @@ config: let
|
||||||
enableDaemon = false;
|
enableDaemon = false;
|
||||||
monolithic = false;
|
monolithic = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Use a screen lock command that resets the keyboard layout
|
||||||
|
# before locking, to avoid locking me out when the layout is
|
||||||
|
# in Russian.
|
||||||
|
screenLock = nixpkgs.writeShellScriptBin "tazjin-screen-lock" ''
|
||||||
|
${nixpkgs.xorg.setxkbmap}/bin/setxkbmap us
|
||||||
|
${nixpkgs.xorg.setxkbmap}/bin/setxkbmap -option caps:super
|
||||||
|
exec ${nixpkgs.xsecurelock}/bin/xsecurelock
|
||||||
|
'';
|
||||||
in lib.fix(self: {
|
in lib.fix(self: {
|
||||||
imports = [
|
imports = [
|
||||||
"${depot.third_party.impermanence}/nixos.nix"
|
"${depot.third_party.impermanence}/nixos.nix"
|
||||||
|
@ -195,6 +204,7 @@ in lib.fix(self: {
|
||||||
emacs
|
emacs
|
||||||
third_party.lieer
|
third_party.lieer
|
||||||
tools.nsfv-setup
|
tools.nsfv-setup
|
||||||
|
screenLock
|
||||||
]) ++
|
]) ++
|
||||||
|
|
||||||
# programs from nixpkgs
|
# programs from nixpkgs
|
||||||
|
@ -279,6 +289,15 @@ in lib.fix(self: {
|
||||||
pull.rebase = true;
|
pull.rebase = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.screen-locker = {
|
||||||
|
enable = true;
|
||||||
|
enableDetectSleep = true;
|
||||||
|
inactiveInterval = 10; # minutes
|
||||||
|
lockCmd = "${screenLock}/bin/tazjin-screen-lock";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.startServices = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "20.09";
|
system.stateVersion = "20.09";
|
||||||
|
|
Loading…
Reference in a new issue