From 7026f6071752423ed55d3e7dfa0b4112d39efb9a Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 23 Aug 2019 17:26:41 +0200 Subject: add config + command line option for setting initial window width/height --- config.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index eb9031ed..d410b721 100644 --- a/config.c +++ b/config.c @@ -159,6 +159,19 @@ parse_section_main(const char *key, const char *value, struct config *conf, conf->shell = strdup(value); } + else if (strcmp(key, "geometry") == 0) { + unsigned width, height; + if (sscanf(value, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) { + LOG_ERR( + "%s: %d: expected WIDTHxHEIGHT, where both are positive integers: %s", + path, lineno, value); + return false; + } + + conf->width = width; + conf->height = height; + } + else if (strcmp(key, "font") == 0) { char *copy = strdup(value); for (const char *font = strtok(copy, ","); font != NULL; font = strtok(NULL, ",")) @@ -440,6 +453,8 @@ config_load(struct config *conf) *conf = (struct config) { .term = strdup("foot"), .shell = get_shell(), + .width = -1, + .height = -1, .fonts = tll_init(), .scrollback_lines = 1000, -- cgit v1.3