diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-14 22:27:18 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-12-17 23:10:59 +0100 |
commit | 140d9ebd912ed803dd916c6ab3783a79a2a724e3 (patch) | |
tree | 04d1ec36e60f94adc63b79491fc8d05e7bd2c9f4 /src/actions.h | |
parent | 0f49ee5f746592352b6ac26449e87339cc3702a8 (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/actions.h')
-rw-r--r-- | src/actions.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/actions.h b/src/actions.h new file mode 100644 index 00000000..b5319bea --- /dev/null +++ b/src/actions.h @@ -0,0 +1,32 @@ +/* + * File: actions.h + * + * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + */ + +#ifndef ACTIONS_H +#define ACTIONS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "dlib/dlib.h" + +typedef struct { + char *label; + char *cmd; +} Action; + +void a_Actions_init(void); +Dlist *a_Actions_link_get(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* ACTIONS_H*/ |