marleyos/modules/home/services/screen-locker/default.nix
2024-11-23 13:09:53 -08:00

28 lines
635 B
Nix

{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.services.screen-locker;
hasXorg = config.xsession.enable;
hasI3 = config.xsession.windowManager.i3.enable;
in
{
options.marleyos.services.screen-locker.enable = mkEnableOption "screen-locker";
config = mkIf (cfg.enable && hasXorg) {
services.screen-locker = {
enable = true;
inactiveInterval = 20;
# exec xss-lock {xss-lock.extraOptions} -- {lockCmd}
xss-lock.extraOptions = [ "--transfer-sleep-lock" ];
lockCmd = if hasI3 then "${pkgs.i3lock}/bin/i3lock --nofork" else "";
};
};
}