mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-18 05:34:02 -04:00
conf: TERM can now be set in footrc
This commit is contained in:
parent
d5157c15b0
commit
7e36027237
3 changed files with 11 additions and 4 deletions
12
config.c
12
config.c
|
|
@ -85,9 +85,9 @@ static bool
|
||||||
parse_section_main(const char *key, const char *value, struct config *conf,
|
parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
const char *path, unsigned lineno)
|
const char *path, unsigned lineno)
|
||||||
{
|
{
|
||||||
if (strcmp(key, "font") == 0) {
|
if (strcmp(key, "term") == 0) {
|
||||||
free(conf->font);
|
free(conf->term);
|
||||||
conf->font = strdup(value);
|
conf->term = strdup(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "shell") == 0) {
|
else if (strcmp(key, "shell") == 0) {
|
||||||
|
|
@ -95,6 +95,11 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
conf->shell = strdup(value);
|
conf->shell = strdup(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "font") == 0) {
|
||||||
|
free(conf->font);
|
||||||
|
conf->font = strdup(value);
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
LOG_WARN("%s:%u: invalid key: %s", path, lineno, key);
|
LOG_WARN("%s:%u: invalid key: %s", path, lineno, key);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -211,6 +216,7 @@ config_load(struct config *conf)
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
*conf = (struct config) {
|
*conf = (struct config) {
|
||||||
|
.term = strdup("foot"),
|
||||||
.shell = get_shell(),
|
.shell = get_shell(),
|
||||||
.font = strdup("monospace"),
|
.font = strdup("monospace"),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
1
config.h
1
config.h
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct config {
|
struct config {
|
||||||
|
char *term;
|
||||||
char *shell;
|
char *shell;
|
||||||
char *font;
|
char *font;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
2
main.c
2
main.c
|
|
@ -312,7 +312,7 @@ main(int argc, char *const *argv)
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
setenv("TERM", "foot", 1); /* TODO: configurable */
|
setenv("TERM", conf.term, 1);
|
||||||
|
|
||||||
int repeat_pipe_fds[2] = {-1, -1};
|
int repeat_pipe_fds[2] = {-1, -1};
|
||||||
if (pipe2(repeat_pipe_fds, O_CLOEXEC) == -1) {
|
if (pipe2(repeat_pipe_fds, O_CLOEXEC) == -1) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue