diff --git a/modules/programs/mpv.nix b/modules/programs/mpv.nix index eb9c9c4a..26cad111 100644 --- a/modules/programs/mpv.nix +++ b/modules/programs/mpv.nix @@ -176,6 +176,20 @@ in { } ''; }; + + extraInput = mkOption { + description = '' + Additional lines that are appended to {file}`$XDG_CONFIG_HOME/mpv/input.conf`. + See {manpage}`mpv(1)` for the full list of options. + ''; + type = with types; lines; + default = ""; + example = '' + esc quit #! Quit + # script-binding uosc/video #! Video tracks + # additional comments + ''; + }; }; }; @@ -199,8 +213,11 @@ in { ${optionalString (cfg.profiles != { }) (renderProfiles cfg.profiles)} ''; }) - (mkIf (cfg.bindings != { }) { - xdg.configFile."mpv/input.conf".text = renderBindings cfg.bindings; + (mkIf (cfg.bindings != { } || cfg.extraInput != "") { + xdg.configFile."mpv/input.conf".text = mkMerge [ + (mkIf (cfg.bindings != { }) (renderBindings cfg.bindings)) + (mkIf (cfg.extraInput != "") cfg.extraInput) + ]; }) { xdg.configFile = mapAttrs' (name: value: diff --git a/tests/modules/programs/mpv/mpv-example-settings-expected-bindings b/tests/modules/programs/mpv/mpv-example-settings-expected-bindings index 7a2ee13b..d4ff9c4d 100644 --- a/tests/modules/programs/mpv/mpv-example-settings-expected-bindings +++ b/tests/modules/programs/mpv/mpv-example-settings-expected-bindings @@ -1,3 +1,4 @@ Alt+0 set window-scale 0.5 WHEEL_DOWN seek -10 -WHEEL_UP seek 10 \ No newline at end of file +WHEEL_UP seek 10 +# script-binding uosc/video #! Video tracks diff --git a/tests/modules/programs/mpv/mpv-example-settings.nix b/tests/modules/programs/mpv/mpv-example-settings.nix index 9974aff6..002e071c 100644 --- a/tests/modules/programs/mpv/mpv-example-settings.nix +++ b/tests/modules/programs/mpv/mpv-example-settings.nix @@ -12,6 +12,10 @@ "Alt+0" = "set window-scale 0.5"; }; + extraInput = '' + # script-binding uosc/video #! Video tracks + ''; + config = { force-window = true; ytdl-format = "bestvideo+bestaudio";