diff options
author | niki-on-github <63949202+niki-on-github@users.noreply.github.com> | 2022-12-11 17:12:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-11 17:12:39 +0000 |
commit | 108550fcf8d3ed8664c0e05defceaf20b4d2b49e (patch) | |
tree | c6f91d57c76c88f1933cd8e6619adcf56c39f66e /src/config.c | |
parent | 4ac4408ee7d9af91b9f9e3c7734aa2f673ef5cdc (diff) |
Add home path substitution for --font option.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index 99a4494..3f61f8b 100644 --- a/src/config.c +++ b/src/config.c @@ -334,7 +334,11 @@ bool parse_option(struct tofi *tofi, const char *filename, size_t lineno, const } else if (strcasecmp(option, "output") == 0) { snprintf(tofi->target_output_name, N_ELEM(tofi->target_output_name), "%s", value); } else if (strcasecmp(option, "font") == 0) { - snprintf(tofi->window.entry.font_name, N_ELEM(tofi->window.entry.font_name), "%s", value); + if ((strlen(value) > 2) && (value[0] == '~') && (value[1] == '/')) { + snprintf(tofi->window.entry.font_name, N_ELEM(tofi->window.entry.font_name), "%s%s", getenv("HOME"), &(value[1])); + } else { + snprintf(tofi->window.entry.font_name, N_ELEM(tofi->window.entry.font_name), "%s", value); + } } else if (strcasecmp(option, "font-size") == 0) { uint32_t val = parse_uint32(filename, lineno, value, &err); if (val == 0) { |