diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 7b4068ff..e6fdf202 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2472,15 +2472,15 @@ static struct cmd_t command_defs[] = CMD_TAG_DISCOVERY) CMD_SYN( "/executable avatar ", - "/executable urlopen ", - "/executable urlsave ") + "/executable urlopen (|*) ", + "/executable urlsave (|*) ") CMD_DESC( "Configure executable that should be called upon a certain command." "Default is xdg-open.") CMD_ARGS( { "avatar", "Set executable that is run in /avatar open. Use your favourite image viewer." }, - { "urlopen", "Set executable that is run in /url open for a given file type. It may be your favorite browser or a specific viewer." }, - { "urlsave", "Set executable that is run in /url save for a given protocol. Use your favourite downloader."}) + { "urlopen", "Set executable that is run in /url open for a given file type. It may be your favorite browser or a specific viewer. Use * to set default command for undefined file type." }, + { "urlsave", "Set executable that is run in /url save for a given protocol. Use your favourite downloader. Use * to set default command for undefined protocol."}) CMD_EXAMPLES( "/executable avatar xdg-open", "/executable urlopen html false \"firefox %u\"", diff --git a/src/config/preferences.c b/src/config/preferences.c index 721ead46..088e91f8 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -537,18 +537,23 @@ prefs_get_string_list_with_option(preference_t pref, gchar *option) char **def = _get_default_string_list(pref); gchar **result = g_key_file_get_locale_string_list(prefs, group, key, option, NULL, NULL); - - if (result == NULL) { - if (def) { - return def; - } else { - g_strfreev(def); - return NULL; - } - } else { + if (result) { g_strfreev(def); return result; } + + result = g_key_file_get_string_list(prefs, group, key, NULL, NULL); + if (result) { + g_strfreev(def); + return result; + } + + if (def) { + return def; + } else { + g_strfreev(def); + return NULL; + } } void @@ -587,13 +592,21 @@ prefs_set_string_list_with_option(preference_t pref, char *option, const gchar* const char *group = _get_group(pref); const char *key = _get_key(pref); if (values == NULL || *values == NULL){ - g_key_file_set_locale_string_list(prefs, group, key, option, NULL, 0); + if (g_strcmp0(option, "*") == 0) { + g_key_file_set_string_list(prefs, group, key, NULL, 0); + } else { + g_key_file_set_locale_string_list(prefs, group, key, option, NULL, 0); + } } else { guint num_values = 0; while(values[num_values]) { - num_values++; + num_values++; + } + if (g_strcmp0(option, "*") == 0) { + g_key_file_set_string_list(prefs, group, key, values, num_values); + } else { + g_key_file_set_locale_string_list(prefs, group, key, option, values, num_values); } - g_key_file_set_locale_string_list(prefs, group, key, option, values, num_values); } }