diff options
author | GhostNaN <GhostNaN@protonmail.com> | 2024-01-27 13:58:31 -0500 |
---|---|---|
committer | GhostNaN <GhostNaN@protonmail.com> | 2024-01-27 13:58:31 -0500 |
commit | 99080dc4b5589cff73dd401166209b6182f6162b (patch) | |
tree | febcb059913ccd2b62c05798d731dd4b47c438d7 | |
parent | a25ec0c2de53b3742cb7db77f3615b94c78b7705 (diff) |
Load mpv configs the sane way
This also fixes https://github.com/GhostNaN/mpvpaper/issues/58 --profile not working
-rw-r--r-- | src/main.c | 26 |
1 files changed, 3 insertions, 23 deletions
@@ -411,31 +411,11 @@ static void init_threads() { } static void set_init_mpv_options(const struct wl_state *state) { - // Enable user control through terminal by default + // Enable user control through terminal by default and configs mpv_set_option_string(mpv, "input-default-bindings", "yes"); mpv_set_option_string(mpv, "input-terminal", "yes"); mpv_set_option_string(mpv, "terminal", "yes"); - - // Load user configs - const char *home_dir = getenv("HOME"); - char *config_path = calloc(strlen(home_dir)+1 + 30, sizeof(char)); - strcpy(config_path, home_dir); - - char loaded_configs[50] = ""; - - strcpy(config_path+strlen(home_dir), "/.config/mpv/mpv.conf"); - if (mpv_load_config_file(mpv, config_path) == 0) - strcat(loaded_configs, "mpv.conf "); - strcpy(config_path+strlen(home_dir), "/.config/mpv/input.conf"); - if (mpv_load_config_file(mpv, config_path) == 0) - strcat(loaded_configs, "input.conf "); - strcpy(config_path+strlen(home_dir), "/.config/mpv/fonts.conf"); - if (mpv_load_config_file(mpv, config_path) == 0) - strcat(loaded_configs, "fonts.conf "); - free(config_path); - - if (VERBOSE && strcmp(loaded_configs, "")) - cflp_info("Loaded [ %s] user configs from \"~/.config/mpv/\"", loaded_configs); + mpv_set_option_string(mpv, "config", "yes"); // Convenience options passed for slideshow mode if (SLIDESHOW_TIME != 0) { @@ -982,7 +962,7 @@ static void parse_command_line(int argc, char **argv, struct wl_state *state) { // Need at least a output and file or playlist file char *playlist_opt_pointer; if((playlist_opt_pointer = strstr(mpv_options, "--playlist=")) != NULL) { - + // Get file from --playlist by cutting off --playlist=, duping then cutting off the end by \n or null terminator char *playlist_opt = strdup(playlist_opt_pointer+strlen("--playlist=")); video_path = strtok(playlist_opt, "\n"); |