mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +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.
This commit is contained in:
parent
f15cd0f087
commit
095f3e32ae
3 changed files with 25 additions and 9 deletions
|
@ -104,23 +104,26 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = mkOption {
|
exec = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = with types; coercedTo str singleton (listOf str);
|
||||||
default = null;
|
default = [ ];
|
||||||
example =
|
example =
|
||||||
"\${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1";
|
"[ \${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1 ]";
|
||||||
description = ''
|
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:
|
profileStr = name:
|
||||||
{ outputs, exec, ... }:
|
{ outputs, exec, ... }: ''
|
||||||
''
|
|
||||||
profile ${name} {
|
profile ${name} {
|
||||||
${concatStringsSep "\n " (map outputStr outputs)}
|
${
|
||||||
'' + optionalString (exec != null) " exec ${exec}\n" + ''
|
concatStringsSep "\n "
|
||||||
|
(map outputStr outputs ++ map (cmd: "exec ${cmd}") exec)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
|
profile backwardsCompat {
|
||||||
|
output "LVDS-1" enable
|
||||||
|
exec echo "7 eight 9"
|
||||||
|
}
|
||||||
|
|
||||||
profile desktop {
|
profile desktop {
|
||||||
output "eDP-1" disable
|
output "eDP-1" disable
|
||||||
output "Iiyama North America PLE2483H-DP" enable position 0,0
|
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
|
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 "1 two 3"
|
||||||
|
exec echo "4 five 6"
|
||||||
}
|
}
|
||||||
|
|
||||||
profile nomad {
|
profile nomad {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
desktop = {
|
desktop = {
|
||||||
exec = ''echo "1 two 3"'';
|
exec = [ ''echo "1 two 3"'' ''echo "4 five 6"'' ];
|
||||||
outputs = [
|
outputs = [
|
||||||
{
|
{
|
||||||
criteria = "eDP-1";
|
criteria = "eDP-1";
|
||||||
|
@ -32,6 +32,13 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
backwardsCompat = {
|
||||||
|
outputs = [{
|
||||||
|
criteria = "LVDS-1";
|
||||||
|
status = "enable";
|
||||||
|
}];
|
||||||
|
exec = ''echo "7 eight 9"'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
profile test {
|
profile test {
|
||||||
|
|
Loading…
Reference in a new issue