order of arguments to scripts
authorDieter Plaetinck <dieter@plaetinck.be>
Sun, 17 May 2009 14:08:10 +0000 (16:08 +0200)
committerDieter Plaetinck <dieter@plaetinck.be>
Sun, 17 May 2009 14:08:10 +0000 (16:08 +0200)
README
uzbl.c

diff --git a/README b/README
index a43e0cd..41c3def 100644 (file)
--- a/README
+++ b/README
@@ -102,7 +102,7 @@ You can use external scripts with uzbl the following ways:
 
 Have a look at the sample configs and scripts!
 
-Scripts that are called by uzbl are passed the following arguments:
+Handler scripts that are called by uzbl are passed the following arguments:
 
     $1 uzbl-config-file
     $2 uzbl-pid
@@ -135,6 +135,8 @@ The script specific arguments are this:
     $11 cookie (only with PUT requests)
 
 
+Custom, userdefined scripts (`spawn foo bar`) get first the arguments as specified in the config and then the above 7 are added at the end.
+
 ### COMMAND LINE ARGUMENTS
 
     -u, --uri=URI            Uri to load (equivalent to 'set uri = URI')
diff --git a/uzbl.c b/uzbl.c
index 8ddaf48..b8ac195 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -764,6 +764,20 @@ run_command (const char *command, const char *args, const gboolean sync, char **
 static void
 spawn(WebKitWebView *web_view, const char *param) {
     (void)web_view;
+/*
+   TODO: allow more control over argument order so that users can have some arguments before the default ones from run_command, and some after
+    gchar** cmd = g_strsplit(param, " ", 2);
+    gchar * args = NULL;
+    if (cmd[1]) {
+        args = g_shell_quote(cmd[1]);
+    }
+    if (cmd) {
+        run_command(cmd[0], args, FALSE, NULL);
+    }
+    if (args) {
+        g_free(args);
+    }
+*/
     run_command(param, NULL, FALSE, NULL);
 }