From 140d9ebd912ed803dd916c6ab3783a79a2a724e3 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 14 Jun 2024 22:27:18 +0200 Subject: Add support for user actions in the link menu Allows the user to define additional entries in the link menu which will execute the given program/script. Each actions is defined using the "link_action" option. The link URL is stored in the $url enviroment variable and the current page in $origin, so the user can customize how do the handling. Here is a simple example to add three new entries: link_action="Debug variables:echo url=$url origin=$origin" link_action="Open in MPV:mpv $url" link_action="Open in Firefox:firefox $url" The command is spawned in a forked process using the system() call, which uses the shell to expand any variable. In particular, the $url variable is set to the current URL being opened. Fixes: https://github.com/dillo-browser/dillo/issues/3 --- src/prefs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/prefs.c') diff --git a/src/prefs.c b/src/prefs.c index 4a68e4c9..a57c792c 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -85,6 +85,7 @@ void a_Prefs_init(void) prefs.scroll_switches_tabs = TRUE; prefs.scroll_switches_tabs_reverse = FALSE; prefs.no_proxy = dStrdup(PREFS_NO_PROXY); + prefs.link_actions = dList_new(16); prefs.panel_size = P_medium; prefs.parse_embedded_css=TRUE; prefs.save_dir = dStrdup(PREFS_SAVE_DIR); -- cgit v1.2.3