mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-09 10:06:20 -05:00
config: add 'server_socket_path' and set a default value
This commit is contained in:
parent
6ef65058cf
commit
6d31bd63be
2 changed files with 16 additions and 0 deletions
14
config.c
14
config.c
|
|
@ -450,6 +450,18 @@ err:
|
|||
return false;
|
||||
}
|
||||
|
||||
static char *
|
||||
get_server_socket_path(void)
|
||||
{
|
||||
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
||||
if (xdg_runtime == NULL)
|
||||
return strdup("/tmp/foot.sock");
|
||||
|
||||
char *path = malloc(strlen(xdg_runtime) + 1 + strlen("foot.sock") + 1);
|
||||
sprintf(path, "%s/foot.sock", xdg_runtime);
|
||||
return path;
|
||||
}
|
||||
|
||||
bool
|
||||
config_load(struct config *conf)
|
||||
{
|
||||
|
|
@ -498,6 +510,7 @@ config_load(struct config *conf)
|
|||
},
|
||||
|
||||
.render_worker_count = sysconf(_SC_NPROCESSORS_ONLN),
|
||||
.server_socket_path = get_server_socket_path(),
|
||||
};
|
||||
|
||||
char *path = get_config_path();
|
||||
|
|
@ -531,4 +544,5 @@ config_free(struct config conf)
|
|||
free(conf.term);
|
||||
free(conf.shell);
|
||||
tll_free_and_free(conf.fonts, free);
|
||||
free(conf.server_socket_path);
|
||||
}
|
||||
|
|
|
|||
2
config.h
2
config.h
|
|
@ -34,6 +34,8 @@ struct config {
|
|||
} cursor;
|
||||
|
||||
size_t render_worker_count;
|
||||
|
||||
char *server_socket_path;
|
||||
};
|
||||
|
||||
bool config_load(struct config *conf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue