home: wm: add screen-lock
This commit is contained in:
parent
54a20058fb
commit
9f6c614c9f
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
mkRelatedOption = description: relatedWMs:
|
||||
let
|
||||
|
@ -14,6 +14,7 @@ in
|
|||
./i3.nix
|
||||
./i3bar.nix
|
||||
./rofi.nix
|
||||
./screen-lock.nix
|
||||
];
|
||||
|
||||
options.my.home.wm = with lib; {
|
||||
|
@ -35,5 +36,23 @@ in
|
|||
rofi = {
|
||||
enable = mkRelatedOption "rofi menu" [ "i3" ];
|
||||
};
|
||||
|
||||
screen-lock = {
|
||||
enable = mkRelatedOption "automatic X screen locker" [ "i3" ];
|
||||
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.i3lock}/bin/i3lock -n -c 000000";
|
||||
example = "\${pkgs.i3lock}/bin/i3lock -n -i lock.png";
|
||||
description = "Locker command to run";
|
||||
};
|
||||
|
||||
timeout = mkOption {
|
||||
type = types.ints.between 1 60;
|
||||
default = 5;
|
||||
example = 1;
|
||||
description = "Inactive time interval to lock the screen automatically";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
15
home/wm/screen-lock.nix
Normal file
15
home/wm/screen-lock.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.home.wm.screen-lock;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.screen-locker = {
|
||||
enable = true;
|
||||
|
||||
inactiveInterval = cfg.timeout;
|
||||
|
||||
lockCmd = cfg.command;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue