1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Read ~/.config/profanity/inputrc

This commit is contained in:
James Booth 2015-12-06 02:12:20 +00:00
parent e9e54dca44
commit 53fd2b3534
3 changed files with 29 additions and 2 deletions

View File

@ -85,8 +85,7 @@ prefs_load(void)
}
prefs = g_key_file_new();
g_key_file_load_from_file(prefs, prefs_loc, G_KEY_FILE_KEEP_COMMENTS,
NULL);
g_key_file_load_from_file(prefs, prefs_loc, G_KEY_FILE_KEEP_COMMENTS, NULL);
err = NULL;
log_maxsize = g_key_file_get_integer(prefs, PREF_GROUP_LOGGING, "maxsize", &err);
@ -920,6 +919,25 @@ prefs_get_aliases(void)
}
}
gchar*
prefs_get_inputrc(void)
{
gchar *xdg_config = xdg_get_config_home();
GString *inputrc_file = g_string_new(xdg_config);
g_free(xdg_config);
g_string_append(inputrc_file, "/profanity/inputrc");
if (g_file_test(inputrc_file->str, G_FILE_TEST_IS_REGULAR)) {
gchar *result = strdup(inputrc_file->str);
g_string_free(inputrc_file, TRUE);
return result;
}
return NULL;
}
void
_free_alias(ProfAlias *alias)
{

View File

@ -222,4 +222,6 @@ gboolean prefs_get_room_notify(const char *const roomjid);
gboolean prefs_get_room_notify_mention(const char *const roomjid);
gboolean prefs_get_room_notify_trigger(const char *const roomjid);
gchar* prefs_get_inputrc(void);
#endif

View File

@ -421,6 +421,13 @@ _inp_rl_startup_hook(void)
// disable readline completion
rl_variable_bind("disable-completion", "on");
// check for and load ~/.config/profanity/inputrc
char *inputrc = prefs_get_inputrc();
if (inputrc) {
rl_read_init_file(inputrc);
free(inputrc);
}
return 0;
}