From 9d8ec857cec426b4f0a3277a63abeb1a420e6107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 31 Jan 2021 14:43:26 +0100 Subject: [PATCH] =?UTF-8?q?url-mode:=20use=20=E2=80=98url-launch=E2=80=99?= =?UTF-8?q?=20from=20config=20to=20open=20URLs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- url-mode.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/url-mode.c b/url-mode.c index 170be4c9..a4fea23f 100644 --- a/url-mode.c +++ b/url-mode.c @@ -90,7 +90,22 @@ urls_input(struct seat *seat, struct terminal *term, uint32_t key, if (chars != (size_t)-1) { char url_utf8[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);