diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b66cd2d5b..4fb015f32 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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 diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 5c87127aa..7743b3426 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -247,4 +247,10 @@ github = "sebtm"; githubId = 17243347; }; + rszamszur = { + name = "Radosław Szamszur"; + email = "radoslawszamszur@gmail.com"; + github = "rszamszur"; + githubId = 10353018; + }; } diff --git a/modules/services/screen-locker.nix b/modules/services/screen-locker.nix index 34794d1c1..3ea84ebed 100644 --- a/modules/services/screen-locker.nix +++ b/modules/services/screen-locker.nix @@ -94,6 +94,16 @@ in { Extra command-line arguments to pass to xss-lock. ''; }; + + screensaverCycle = mkOption { + type = types.int; + default = 600; + description = '' + X server's screensaver cycle value expresed as seconds. + This will be used with xset 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 = { diff --git a/tests/modules/services/screen-locker/no-xautolock.nix b/tests/modules/services/screen-locker/no-xautolock.nix index 03ab0868c..7ec5152b0 100644 --- a/tests/modules/services/screen-locker/no-xautolock.nix +++ b/tests/modules/services/screen-locker/no-xautolock.nix @@ -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' ''; }; }