Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion modules/services/swayidle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ in

package = lib.mkPackageOption pkgs "swayidle" { };

idlehint = mkOption {
type = with types; nullOr int;
default = null;
description = "If non-null, sets the timeout in seconds to indicate an idle login session to logind.";
};

timeouts = mkOption {
type = with types; listOf (submodule timeoutModule);
default = [ ];
Expand Down Expand Up @@ -189,7 +195,11 @@ in
args =
cfg.extraArgs
++ (lib.concatMap mkTimeout cfg.timeouts)
++ (lib.flatten (lib.mapAttrsToList mkEvent nonemptyEvents));
++ (lib.flatten (lib.mapAttrsToList mkEvent nonemptyEvents))
++ lib.optionals (cfg.idlehint != null) [
"idlehint"
(toString cfg.idlehint)
];
in
"${lib.getExe cfg.package} ${lib.escapeShellArgs args}";
};
Expand Down
3 changes: 2 additions & 1 deletion tests/modules/services/swayidle/basic-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
before-sleep = "swaylock -fF";
lock = "swaylock -fF";
};
idlehint = 300;
};

nmt.script = ''
Expand All @@ -38,7 +39,7 @@

[Service]
Environment=PATH=@bash-interactive@/bin
ExecStart=@swayidle@/bin/dummy -w timeout 50 'notify-send -t 10000 -- "Screen lock in 10 seconds"' timeout 60 'swaylock -fF' timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -fF' lock 'swaylock -fF'
ExecStart=@swayidle@/bin/dummy -w timeout 50 'notify-send -t 10000 -- "Screen lock in 10 seconds"' timeout 60 'swaylock -fF' timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -fF' lock 'swaylock -fF' idlehint 300
Restart=always
Type=simple

Expand Down