mirror of
https://github.com/nix-community/home-manager
synced 2024-12-05 01:19:46 +01:00
kanshi: allow multiple exec statements per profile
kanshi configurations can have more than one exec statement in a
profile. This change allows services.kanshi.profiles.<name>.exec to be
a list of strings rather than a single string.
(cherry picked from commit 095f3e32ae
)
This commit is contained in:
parent
7d9ba15214
commit
0e58ffec58
3 changed files with 25 additions and 9 deletions
|
@ -104,23 +104,26 @@ let
|
|||
};
|
||||
|
||||
exec = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
type = with types; coercedTo str singleton (listOf str);
|
||||
default = [ ];
|
||||
example =
|
||||
"\${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1";
|
||||
"[ \${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1 ]";
|
||||
description = ''
|
||||
Command executed after the profile is succesfully applied.
|
||||
Commands executed after the profile is succesfully applied.
|
||||
Note that if you provide multiple commands, they will be
|
||||
executed asynchronously with no guaranteed ordering.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
profileStr = name:
|
||||
{ outputs, exec, ... }:
|
||||
''
|
||||
{ outputs, exec, ... }: ''
|
||||
profile ${name} {
|
||||
${concatStringsSep "\n " (map outputStr outputs)}
|
||||
'' + optionalString (exec != null) " exec ${exec}\n" + ''
|
||||
${
|
||||
concatStringsSep "\n "
|
||||
(map outputStr outputs ++ map (cmd: "exec ${cmd}") exec)
|
||||
}
|
||||
}
|
||||
'';
|
||||
in {
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
profile backwardsCompat {
|
||||
output "LVDS-1" enable
|
||||
exec echo "7 eight 9"
|
||||
}
|
||||
|
||||
profile desktop {
|
||||
output "eDP-1" disable
|
||||
output "Iiyama North America PLE2483H-DP" enable position 0,0
|
||||
output "Iiyama North America PLE2483H-DP 1158765348486" enable mode 1920x1080 position 1920,0 scale 2.100000 transform flipped-270
|
||||
exec echo "1 two 3"
|
||||
exec echo "4 five 6"
|
||||
}
|
||||
|
||||
profile nomad {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
}];
|
||||
};
|
||||
desktop = {
|
||||
exec = ''echo "1 two 3"'';
|
||||
exec = [ ''echo "1 two 3"'' ''echo "4 five 6"'' ];
|
||||
outputs = [
|
||||
{
|
||||
criteria = "eDP-1";
|
||||
|
@ -32,6 +32,13 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
backwardsCompat = {
|
||||
outputs = [{
|
||||
criteria = "LVDS-1";
|
||||
status = "enable";
|
||||
}];
|
||||
exec = ''echo "7 eight 9"'';
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
profile test {
|
||||
|
|
Loading…
Reference in a new issue