mpv: add extraInput option

This commit is contained in:
Lichthagel 2024-04-29 15:49:58 +02:00 committed by Robert Helgesson
parent 2af7c78b7b
commit b8d81ef15e
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 25 additions and 3 deletions

View file

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

View file

@ -1,3 +1,4 @@
Alt+0 set window-scale 0.5
WHEEL_DOWN seek -10
WHEEL_UP seek 10
WHEEL_UP seek 10
# script-binding uosc/video #! Video tracks

View file

@ -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";