mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-15 05:33:58 -04: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]`.
|
* `[colors-light]` section to `foot.ini`. Replaces `[colors2]`.
|
||||||
* `XTGETTCAP`: added `query-os-name`, returning the OS foot is
|
* `XTGETTCAP`: added `query-os-name`, returning the OS foot is
|
||||||
compiled for (e.g. _'Linux'_) ([#2209][2209]).
|
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
|
[2212]: https://codeberg.org/dnkl/foot/issues/2212
|
||||||
[2209]: https://codeberg.org/dnkl/foot/issues/2209
|
[2209]: https://codeberg.org/dnkl/foot/issues/2209
|
||||||
|
[2259]: https://codeberg.org/dnkl/foot/pulls/2259
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### 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();
|
enum fcft_capabilities fcft_caps = fcft_capabilities();
|
||||||
|
|
||||||
*conf = (struct config) {
|
*conf = (struct config) {
|
||||||
|
.conf_path = (conf_path ? xstrdup(conf_path) : NULL),
|
||||||
.term = xstrdup(FOOT_DEFAULT_TERM),
|
.term = xstrdup(FOOT_DEFAULT_TERM),
|
||||||
.shell = get_shell(),
|
.shell = get_shell(),
|
||||||
.title = xstrdup("foot"),
|
.title = xstrdup("foot"),
|
||||||
|
|
@ -3895,6 +3896,7 @@ config_clone(const struct config *old)
|
||||||
struct config *conf = xmalloc(sizeof(*conf));
|
struct config *conf = xmalloc(sizeof(*conf));
|
||||||
*conf = *old;
|
*conf = *old;
|
||||||
|
|
||||||
|
conf->conf_path = (old->conf_path ? xstrdup(old->conf_path) : NULL);
|
||||||
conf->term = xstrdup(old->term);
|
conf->term = xstrdup(old->term);
|
||||||
conf->shell = xstrdup(old->shell);
|
conf->shell = xstrdup(old->shell);
|
||||||
conf->title = xstrdup(old->title);
|
conf->title = xstrdup(old->title);
|
||||||
|
|
@ -3995,6 +3997,7 @@ UNITTEST
|
||||||
void
|
void
|
||||||
config_free(struct config *conf)
|
config_free(struct config *conf)
|
||||||
{
|
{
|
||||||
|
free(conf->conf_path);
|
||||||
free(conf->term);
|
free(conf->term);
|
||||||
free(conf->shell);
|
free(conf->shell);
|
||||||
free(conf->title);
|
free(conf->title);
|
||||||
|
|
|
||||||
1
config.h
1
config.h
|
|
@ -217,6 +217,7 @@ enum center_when {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct config {
|
struct config {
|
||||||
|
char *conf_path;
|
||||||
char *term;
|
char *term;
|
||||||
char *shell;
|
char *shell;
|
||||||
char *title;
|
char *title;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ the foot command line
|
||||||
*-c*,*--config*=_PATH_
|
*-c*,*--config*=_PATH_
|
||||||
Path to configuration file, see *foot.ini*(5) for details.
|
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*
|
*-C*,*--check-config*
|
||||||
Verify configuration and then exit with 0 if ok, otherwise exit
|
Verify configuration and then exit with 0 if ok, otherwise exit
|
||||||
with 230 (see *EXIT STATUS*).
|
with 230 (see *EXIT STATUS*).
|
||||||
|
|
|
||||||
12
terminal.c
12
terminal.c
|
|
@ -3802,8 +3802,18 @@ term_bell(struct terminal *term)
|
||||||
bool
|
bool
|
||||||
term_spawn_new(const struct terminal *term)
|
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(
|
return spawn(
|
||||||
term->reaper, term->cwd, (char *const []){term->foot_exe, NULL},
|
term->reaper, term->cwd, argv,
|
||||||
-1, -1, -1, NULL, NULL, NULL) >= 0;
|
-1, -1, -1, NULL, NULL, NULL) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue