mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-22 10:19:39 +01:00
swayidle: minor cleanups
This commit is contained in:
parent
4803bf558b
commit
0b052dd811
2 changed files with 34 additions and 31 deletions
|
|
@ -6,18 +6,6 @@ let
|
|||
|
||||
cfg = config.services.swayidle;
|
||||
|
||||
mkTimeout = t:
|
||||
[ "timeout" (toString t.timeout) (escapeShellArg t.command) ]
|
||||
++ optionals (t.resumeCommand != null) [
|
||||
"resume"
|
||||
(escapeShellArg t.resumeCommand)
|
||||
];
|
||||
|
||||
mkEvent = e: [ e.event (escapeShellArg e.command) ];
|
||||
|
||||
args = cfg.extraArgs ++ (concatMap mkTimeout cfg.timeouts)
|
||||
++ (concatMap mkEvent cfg.events);
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.c0deaddict ];
|
||||
|
||||
|
|
@ -127,7 +115,16 @@ in {
|
|||
Restart = "always";
|
||||
# swayidle executes commands using "sh -c", so the PATH needs to contain a shell.
|
||||
Environment = [ "PATH=${makeBinPath [ pkgs.bash ]}" ];
|
||||
ExecStart = "${cfg.package}/bin/swayidle ${concatStringsSep " " args}";
|
||||
ExecStart = let
|
||||
mkTimeout = t:
|
||||
[ "timeout" (toString t.timeout) t.command ]
|
||||
++ optionals (t.resumeCommand != null) [ "resume" t.resumeCommand ];
|
||||
|
||||
mkEvent = e: [ e.event e.command ];
|
||||
|
||||
args = cfg.extraArgs ++ (concatMap mkTimeout cfg.timeouts)
|
||||
++ (concatMap mkEvent cfg.events);
|
||||
in "${getExe cfg.package} ${escapeShellArgs args}";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ cfg.systemdTarget ]; };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue