mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-17 05:33:52 -04:00
Add support for creating utmp records
This patch adds support for creating utmp records using the ‘utempter’ helper binary from the ‘libutempter’ package. * New config option ‘main.utempter’ * New meson command line option, -Ddefault-utempter-path. Defaults to auto-detecting the path. The default value of the new ‘main.utempter’ config option depends on the meson command line option ‘-Ddefault-utempter-path’. If ‘main.utempter’ is *not* set to ‘none’, foot will try to execute the utempter helper binary to create utmp records when a new terminal is instantiated. The record is removed when the terminal instance is destroyed.
This commit is contained in:
parent
77b74734a4
commit
aa10b1d2da
11 changed files with 105 additions and 11 deletions
19
config.c
19
config.c
|
|
@ -944,6 +944,18 @@ parse_section_main(struct context *ctx)
|
|||
else if (strcmp(key, "box-drawings-uses-font-glyphs") == 0)
|
||||
return value_to_bool(ctx, &conf->box_drawings_uses_font_glyphs);
|
||||
|
||||
else if (strcmp(key, "utempter") == 0) {
|
||||
if (!value_to_str(ctx, &conf->utempter_path))
|
||||
return false;
|
||||
|
||||
if (strcmp(conf->utempter_path, "none") == 0) {
|
||||
free(conf->utempter_path);
|
||||
conf->utempter_path = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else {
|
||||
LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
|
||||
return false;
|
||||
|
|
@ -2937,6 +2949,9 @@ config_load(struct config *conf, const char *conf_path,
|
|||
},
|
||||
|
||||
.env_vars = tll_init(),
|
||||
.utempter_path = (strlen(FOOT_DEFAULT_UTEMPTER_PATH) > 0
|
||||
? xstrdup(FOOT_DEFAULT_UTEMPTER_PATH)
|
||||
: NULL),
|
||||
.notifications = tll_init(),
|
||||
};
|
||||
|
||||
|
|
@ -3225,6 +3240,9 @@ config_clone(const struct config *old)
|
|||
tll_push_back(conf->env_vars, copy);
|
||||
}
|
||||
|
||||
conf->utempter_path =
|
||||
old->utempter_path != NULL ? xstrdup(old->utempter_path) : NULL;
|
||||
|
||||
conf->notifications.length = 0;
|
||||
conf->notifications.head = conf->notifications.tail = 0;
|
||||
tll_foreach(old->notifications, it) {
|
||||
|
|
@ -3291,6 +3309,7 @@ config_free(struct config *conf)
|
|||
tll_remove(conf->env_vars, it);
|
||||
}
|
||||
|
||||
free(conf->utempter_path);
|
||||
user_notifications_free(&conf->notifications);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue