summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2024-01-14 21:36:32 +0100
committerDudemanguy <random342@airmail.cc>2024-02-04 15:12:02 +0000
commit4ab521f08010329701885d4e383a6de77589a389 (patch)
treec1a499c1778351b837c072cd01a75af113cd5312 /player/command.c
parent68e3412feeab5c8b0c70d5799c3721532af85c35 (diff)
downloadmpv-4ab521f08010329701885d4e383a6de77589a389.tar.bz2
mpv-4ab521f08010329701885d4e383a6de77589a389.tar.xz
command: add load-input-conf
This can be used to auto reload the input configuration file, e.g. in vim: autocmd BufWritePost ~/.config/mpv/input.conf silent !echo load-input-conf %:p | socat - /tmp/mpvsocket Partially fixes #6362. Additionally this can be used as a replacement for deprecated input sections if they are ever actually removed. For example, if you want to define different bindings for images, you can load-input-conf an input.conf for images, and load the original again when switching to a video. Though currently you would have to redefine builtin bindings that were overwritten with image ones in the default input.conf.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 1ad7868a7f..f84806ae52 100644
--- a/player/command.c
+++ b/player/command.c
@@ -6288,6 +6288,15 @@ static void cmd_load_config_file(void *p)
mp_notify_property(mpctx, "profile-list");
}
+static void cmd_load_input_conf(void *p)
+{
+ struct mp_cmd_ctx *cmd = p;
+ struct MPContext *mpctx = cmd->mpctx;
+
+ char *config_file = cmd->args[0].v.s;
+ cmd->success = mp_input_load_config_file(mpctx->input, config_file);
+}
+
static void cmd_load_script(void *p)
{
struct mp_cmd_ctx *cmd = p;
@@ -6827,6 +6836,8 @@ const struct mp_cmd_def mp_cmds[] = {
{ "load-config-file", cmd_load_config_file, {{"filename", OPT_STRING(v.s)}} },
+ { "load-input-conf", cmd_load_input_conf, {{"filename", OPT_STRING(v.s)}} },
+
{ "load-script", cmd_load_script, {{"filename", OPT_STRING(v.s)}} },
{ "dump-cache", cmd_dump_cache, { {"start", OPT_TIME(v.d),