aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-23 15:26:41 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-23 15:26:41 +0000
commit7026f6071752423ed55d3e7dfa0b4112d39efb9a (patch)
tree88a8284ef33767adb358447beca5262634604104 /config.c
parentmain: use slave's exit value as our exit value (diff)
add config + command line option for setting initial window width/height
Diffstat (limited to 'config.c')
-rw-r--r--config.c15
1 files changed, 15 insertions, 0 deletions
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,