mpv: add scriptOpts option, fix tests (#3491)

This commit is contained in:
Chuang Zhu 2023-03-21 18:33:36 +08:00 committed by GitHub
parent a8f5ca239f
commit e386ec640e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 18 deletions

View file

@ -34,6 +34,12 @@ let
listsAsDuplicateKeys = true;
};
renderScriptOptions = generators.toKeyValue {
mkKeyValue =
generators.mkKeyValueDefault { mkValueString = renderOption; } "=";
listsAsDuplicateKeys = true;
};
renderProfiles = generators.toINI {
mkKeyValue =
generators.mkKeyValueDefault { mkValueString = renderOptionValue; } "=";
@ -85,6 +91,27 @@ in {
'';
};
scriptOpts = mkOption {
description = ''
Script options added to
<filename>$XDG_CONFIG_HOME/mpv/script-opts/</filename>. See
<citerefentry>
<refentrytitle>mpv</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
for the full list of options of builtin scripts.
'';
type = types.attrsOf mpvOptions;
default = { };
example = {
osc = {
scalewindowed = 2.0;
vidscale = false;
visibility = "always";
};
};
};
config = mkOption {
description = ''
Configuration written to
@ -184,7 +211,13 @@ in {
(mkIf (cfg.bindings != { }) {
xdg.configFile."mpv/input.conf".text = renderBindings cfg.bindings;
})
{
xdg.configFile = mapAttrs' (name: value:
nameValuePair "mpv/script-opts/${name}.conf" {
text = renderScriptOptions value;
}) cfg.scriptOpts;
}
]);
meta.maintainers = with maintainers; [ tadeokondrak thiagokokada ];
meta.maintainers = with maintainers; [ tadeokondrak thiagokokada chuangzhu ];
}