Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command: add load-config-file and load-input-conf #13288

Merged
merged 4 commits into from
Feb 4, 2024

Conversation

guidocella
Copy link
Contributor

This adds the commands load-config-file and load-input-conf. They can be used to auto reload configuration files, e.g. in vim:

autocmd BufWritePost ~/.config/mpv/mpv.conf silent !echo load-config-file %:p | socat - /tmp/mpvsocket
autocmd BufWritePost ~/.config/mpv/input.conf silent !echo load-input-conf %:p | socat - /tmp/mpvsocket

Partially fixes #6362. This is simpler than spawning a thread to observe changes to these files with inotify and doing the equivalent on each platform, but it relies on users configuring their text editor.

Copy link

github-actions bot commented Jan 14, 2024

Download the artifacts for this pull request:

Windows

player/command.c Outdated Show resolved Hide resolved
Unlike set include mpv.conf, this works after playback has started. It
can be used to auto reload the configuration, e.g. in vim:
autocmd BufWritePost ~/.config/mpv/mpv.conf silent !echo load-config-file %:p | socat - /tmp/mpvsocket

Partially fixes mpv-player#6362.
input/input.c Outdated Show resolved Hide resolved
Copy link
Member

@Dudemanguy Dudemanguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works though. Nice feature.

This return value is only used to set bool config_ok in
mp_input_load_config so it makes more sense to return bool.
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 mpv-player#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.
@Dudemanguy Dudemanguy merged commit 4ab521f into mpv-player:master Feb 4, 2024
11 of 12 checks passed
@guidocella guidocella deleted the load-config branch February 4, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to reload input.conf
2 participants