Skip to content

Commit

Permalink
mpv: add extraInput option
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichthagel authored and rycee committed Apr 29, 2024
1 parent 2af7c78 commit b8d81ef
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
21 changes: 19 additions & 2 deletions modules/programs/mpv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
};
};
};

Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions tests/modules/programs/mpv/mpv-example-settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit b8d81ef

Please sign in to comment.