aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README5
-rw-r--r--examples/config/uzbl/config8
-rw-r--r--uzbl-core.c15
3 files changed, 14 insertions, 14 deletions
diff --git a/README b/README
index caebf8b..4672326 100644
--- a/README
+++ b/README
@@ -164,15 +164,12 @@ The following commands are recognized:
- update the contents of the status and title bars
* `event <event_name> [event_details]`
- send custom event
-* menu_add <label> [uzbl command]
+* menu_add <label> = <uzbl command>
- add a new entry "label" that will execute "uzbl command" to the right click menu
- - NOTE: you will need to quote 'label' and 'uzbl command' if they contain any spaces
* menu_add_separator <label>
- adds a separator line to the right click menu
- - no qouting needed
* menu_remove <label>
- removes the entry "label" from the right click menu
- - no quoting needed
### VARIABLES AND CONSTANTS
diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config
index 78c7bec..5a14320 100644
--- a/examples/config/uzbl/config
+++ b/examples/config/uzbl/config
@@ -188,10 +188,10 @@ set formfiller = spawn @scripts_dir/formfiller
# === Context menu items =====================================================
-menu_add Google 'set uri = http://google.com'
-menu_add 'Go Home' 'set uri = http://uzbl.org'
-menu_add_separator
-menu_add 'Quit uzbl' exit
+menu_add Google = set uri = http://google.com
+menu_add Go Home = set uri = http://uzbl.org
+menu_add_separator separator_1
+menu_add Quit uzbl = exit
# === Mode configuration =====================================================
diff --git a/uzbl-core.c b/uzbl-core.c
index 8f59847..2640f0e 100644
--- a/uzbl-core.c
+++ b/uzbl-core.c
@@ -623,9 +623,9 @@ struct {const char *key; CommandInfo value;} cmdlist[] =
*/
{ "request", {event, TRUE} },
{ "update_gui", {update_gui, TRUE} },
- { "menu_add", {menu_add, 0} },
+ { "menu_add", {menu_add, TRUE} },
{ "menu_add_separator", {menu_add_separator, TRUE} },
- { "menu_remove", {menu_remove, TRUE} }
+ { "menu_remove", {menu_remove, TRUE} }
};
void
@@ -692,16 +692,17 @@ menu_add(WebKitWebView *page, GArray *argv, GString *result) {
(void) result;
MenuItem *m;
gchar *item_cmd = NULL;
+ gchar **split = g_strsplit(argv_idx(argv, 0), "=", 2);
if(!uzbl.gui.menu_items)
uzbl.gui.menu_items = g_ptr_array_new();
- if(argv_idx(argv, 1))
- item_cmd = g_strdup(argv_idx(argv, 1));
+ if(split[1])
+ item_cmd = g_strdup(split[1]);
- if(argv_idx(argv, 0)) {
+ if(split[0]) {
m = malloc(sizeof(MenuItem));
- m->name = g_strdup(argv_idx(argv, 0));
+ m->name = g_strdup(split[0]);
m->cmd = g_strdup(item_cmd?item_cmd:"");
m->issep = FALSE;
g_ptr_array_add(uzbl.gui.menu_items, m);
@@ -709,6 +710,8 @@ menu_add(WebKitWebView *page, GArray *argv, GString *result) {
else
g_free(item_cmd);
+ g_strfreev(split);
+
}
void