mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
add config + command line option for setting initial window width/height
This commit is contained in:
parent
4e2067446a
commit
7026f60717
6 changed files with 56 additions and 13 deletions
15
config.c
15
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,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue