mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-07 08:21:02 -04:00
url-mode: use ‘url-launch’ from config to open URLs
This commit is contained in:
parent
06aba59430
commit
9d8ec857ce
1 changed files with 16 additions and 1 deletions
17
url-mode.c
17
url-mode.c
|
|
@ -90,7 +90,22 @@ urls_input(struct seat *seat, struct terminal *term, uint32_t key,
|
||||||
if (chars != (size_t)-1) {
|
if (chars != (size_t)-1) {
|
||||||
char url_utf8[chars + 1];
|
char url_utf8[chars + 1];
|
||||||
wcstombs(url_utf8, match->url, chars + 1);
|
wcstombs(url_utf8, match->url, chars + 1);
|
||||||
spawn(term->reaper, term->cwd, (char *const[]){"xdg-open", url_utf8, NULL}, -1, -1, -1);
|
|
||||||
|
size_t argc;
|
||||||
|
char **argv;
|
||||||
|
|
||||||
|
if (spawn_expand_template(
|
||||||
|
&term->conf->url_launch, 1,
|
||||||
|
(const char *[]){"url"},
|
||||||
|
(const char *[]){url_utf8},
|
||||||
|
&argc, &argv))
|
||||||
|
{
|
||||||
|
spawn(term->reaper, term->cwd, argv, -1, -1, -1);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < argc; i++)
|
||||||
|
free(argv[i]);
|
||||||
|
free(argv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
urls_reset(term);
|
urls_reset(term);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue