1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00: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:
Faye Duxovni 2021-10-02 17:22:36 -04:00 committed by Robert Helgesson
parent f15cd0f087
commit 095f3e32ae
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 25 additions and 9 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {