screen-locker: Add option to configure x screensaver cycle (#2853)

Some screen lockers which will be used with xss-lock might require
to set x screensaver timeout with cycle.
This commit is contained in:
Radosław Szamszur 2022-04-05 05:32:27 +02:00 committed by GitHub
parent 3549f5d0f5
commit a985e711e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 5 deletions

4
.github/CODEOWNERS vendored
View File

@ -378,8 +378,8 @@
/modules/services/redshift-gammastep @rycee @petabyteboy @thiagokokada
/tests/modules/redshift-gammastep @thiagokokada
/modules/services/screen-locker.nix @jrobsonchase
/tests/modules/services/screen-locker @jrobsonchase
/modules/services/screen-locker.nix @jrobsonchase @rszamszur
/tests/modules/services/screen-locker @jrobsonchase @rszamszur
/modules/services/status-notifier-watcher.nix @pltanton

View File

@ -247,4 +247,10 @@
github = "sebtm";
githubId = 17243347;
};
rszamszur = {
name = "Radosław Szamszur";
email = "radoslawszamszur@gmail.com";
github = "rszamszur";
githubId = 10353018;
};
}

View File

@ -94,6 +94,16 @@ in {
Extra command-line arguments to pass to <command>xss-lock</command>.
'';
};
screensaverCycle = mkOption {
type = types.int;
default = 600;
description = ''
X server's screensaver cycle value expresed as seconds.
This will be used with <command>xset</command> to configure
the cycle along with timeout.
'';
};
};
};
@ -122,7 +132,9 @@ in {
}
(mkIf (!cfg.xautolock.enable) {
systemd.user.services.xss-lock.Service.ExecStartPre =
"${pkgs.xorg.xset}/bin/xset s ${toString (cfg.inactiveInterval * 60)}";
"${pkgs.xorg.xset}/bin/xset s ${toString (cfg.inactiveInterval * 60)} ${
toString cfg.xss-lock.screensaverCycle
}";
})
(mkIf cfg.xautolock.enable {
systemd.user.services.xautolock-session = {

View File

@ -6,7 +6,10 @@
enable = true;
inactiveInterval = 5;
lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000";
xss-lock = { extraOptions = [ "-test" ]; };
xss-lock = {
extraOptions = [ "-test" ];
screensaverCycle = 5;
};
xautolock = { enable = false; };
};
@ -18,7 +21,7 @@
assertFileExists $xssService
assertFileRegex $xssService 'ExecStart=.*/bin/xss-lock.*-test.*i3lock -n -c AA0000'
assertFileRegex $xssService 'ExecStartPre=.*/xset s 300'
assertFileRegex $xssService 'ExecStartPre=.*/xset s 300 5'
'';
};
}