aboutsummaryrefslogtreecommitdiff
path: root/src/menu.hh
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-06-14 22:27:18 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-12-17 23:10:59 +0100
commit140d9ebd912ed803dd916c6ab3783a79a2a724e3 (patch)
tree04d1ec36e60f94adc63b79491fc8d05e7bd2c9f4 /src/menu.hh
parent0f49ee5f746592352b6ac26449e87339cc3702a8 (diff)
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
Diffstat (limited to 'src/menu.hh')
-rw-r--r--src/menu.hh3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/menu.hh b/src/menu.hh
index a8170e89..60d230a4 100644
--- a/src/menu.hh
+++ b/src/menu.hh
@@ -9,7 +9,8 @@ extern "C" {
void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url,
bool_t has_bugs, void *v_cssUrls);
-void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url);
+void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url,
+ const DilloUrl *page_url);
void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url,
bool_t loaded_img, DilloUrl *page_url,
DilloUrl *link_url);