aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-31 13:43:26 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-07 15:33:32 +0000
commit9d8ec857cec426b4f0a3277a63abeb1a420e6107 (patch)
treeb72ffbe86013bf2646eb0cd42323e60b39f677ef
parentnotify: break out command template expansion to spawn_expand_template() (diff)
url-mode: use ‘url-launch’ from config to open URLs
-rw-r--r--url-mode.c17
1 files changed, 16 insertions, 1 deletions
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);