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:
parent
e9e54dca44
commit
53fd2b3534
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user