mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
Spawning new terminal with --config from parent instance
Reference: https://codeberg.org/dnkl/foot/issues/1622 Signed-off-by: Stéphane Klein <contact@stephane-klein.info>
This commit is contained in:
parent
b78cc92322
commit
6d8027dd94
5 changed files with 21 additions and 1 deletions
|
|
@ -78,9 +78,12 @@
|
|||
* `[colors-light]` section to `foot.ini`. Replaces `[colors2]`.
|
||||
* `XTGETTCAP`: added `query-os-name`, returning the OS foot is
|
||||
compiled for (e.g. _'Linux'_) ([#2209][2209]).
|
||||
* `--config=PATH` option is now automatically passed to new
|
||||
terminals spawned via `spawn-terminal` action ([#2259][2259]).
|
||||
|
||||
[2212]: https://codeberg.org/dnkl/foot/issues/2212
|
||||
[2209]: https://codeberg.org/dnkl/foot/issues/2209
|
||||
[2259]: https://codeberg.org/dnkl/foot/pulls/2259
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
3
config.c
3
config.c
|
|
@ -3442,6 +3442,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
enum fcft_capabilities fcft_caps = fcft_capabilities();
|
||||
|
||||
*conf = (struct config) {
|
||||
.conf_path = (conf_path ? xstrdup(conf_path) : NULL),
|
||||
.term = xstrdup(FOOT_DEFAULT_TERM),
|
||||
.shell = get_shell(),
|
||||
.title = xstrdup("foot"),
|
||||
|
|
@ -3895,6 +3896,7 @@ config_clone(const struct config *old)
|
|||
struct config *conf = xmalloc(sizeof(*conf));
|
||||
*conf = *old;
|
||||
|
||||
conf->conf_path = (old->conf_path ? xstrdup(old->conf_path) : NULL);
|
||||
conf->term = xstrdup(old->term);
|
||||
conf->shell = xstrdup(old->shell);
|
||||
conf->title = xstrdup(old->title);
|
||||
|
|
@ -3995,6 +3997,7 @@ UNITTEST
|
|||
void
|
||||
config_free(struct config *conf)
|
||||
{
|
||||
free(conf->conf_path);
|
||||
free(conf->term);
|
||||
free(conf->shell);
|
||||
free(conf->title);
|
||||
|
|
|
|||
1
config.h
1
config.h
|
|
@ -217,6 +217,7 @@ enum center_when {
|
|||
};
|
||||
|
||||
struct config {
|
||||
char *conf_path;
|
||||
char *term;
|
||||
char *shell;
|
||||
char *title;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ the foot command line
|
|||
*-c*,*--config*=_PATH_
|
||||
Path to configuration file, see *foot.ini*(5) for details.
|
||||
|
||||
The configuration file is automatically passed to new terminals
|
||||
spawned via *spawn-terminal* (see *foot.ini*(5)).
|
||||
|
||||
*-C*,*--check-config*
|
||||
Verify configuration and then exit with 0 if ok, otherwise exit
|
||||
with 230 (see *EXIT STATUS*).
|
||||
|
|
|
|||
12
terminal.c
12
terminal.c
|
|
@ -3802,8 +3802,18 @@ term_bell(struct terminal *term)
|
|||
bool
|
||||
term_spawn_new(const struct terminal *term)
|
||||
{
|
||||
char *argv[4];
|
||||
int argc = 0;
|
||||
|
||||
argv[argc++] = term->foot_exe;
|
||||
if (term->conf->conf_path != NULL) {
|
||||
argv[argc++] = "--config";
|
||||
argv[argc++] = term->conf->conf_path;
|
||||
}
|
||||
argv[argc] = NULL;
|
||||
|
||||
return spawn(
|
||||
term->reaper, term->cwd, (char *const []){term->foot_exe, NULL},
|
||||
term->reaper, term->cwd, argv,
|
||||
-1, -1, -1, NULL, NULL, NULL) >= 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue