1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-09-28 17:27:28 +02:00

screen-locker: Add extraOptions for xss-lock and xautolock

This commit is contained in:
Minijackson 2018-04-29 15:58:42 +02:00 committed by Robert Helgesson
parent 9141d11a7d
commit 9a3b1ec222
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -26,6 +26,23 @@ in {
See <link xlink:href="https://linux.die.net/man/1/xautolock"/>.
'';
};
xautolockExtraOptions = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Extra command-line arguments to pass to <command>xautolock</command>.
'';
};
xssLockExtraOptions = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Extra command-line arguments to pass to <command>xss-lock</command>.
'';
};
};
config = mkIf cfg.enable {
@ -45,7 +62,8 @@ in {
${pkgs.xautolock}/bin/xautolock \
-detectsleep \
-time ${toString cfg.inactiveInterval} \
-locker '${pkgs.systemd}/bin/loginctl lock-session $XDG_SESSION_ID'
-locker '${pkgs.systemd}/bin/loginctl lock-session $XDG_SESSION_ID' \
${concatStringsSep " " cfg.xautolockExtraOptions}
'';
};
};
@ -53,7 +71,7 @@ in {
# xss-lock will run specified screen locker when the session is locked via loginctl
# can't be started as a systemd service,
# see https://bitbucket.org/raymonad/xss-lock/issues/13/allow-operation-as-systemd-user-unit
xsession.initExtra = "${pkgs.xss-lock}/bin/xss-lock -- ${cfg.lockCmd} &";
xsession.initExtra = "${pkgs.xss-lock}/bin/xss-lock ${concatStringsSep " " cfg.xssLockExtraOptions} -- ${cfg.lockCmd} &";
};
}