aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
authorGravatar Tom Adams <tom@holizz.com>2009-07-11 12:11:13 +0100
committerGravatar Tom Adams <tom@holizz.com>2009-07-11 12:11:13 +0100
commit14a53251bbedb94ff0d78321276d5b0de9504f9a (patch)
tree896ef506d1b5d9e03fbfca095f37722dc748059f /uzbl.c
parent2e47a381f29a593286374ce8638914383e835993 (diff)
Added new_window handler.
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/uzbl.c b/uzbl.c
index a998b91..a5d78f5 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -129,6 +129,7 @@ const struct {
{ "history_handler", PTR(uzbl.behave.history_handler, STR, 1, NULL)},
{ "download_handler", PTR(uzbl.behave.download_handler, STR, 1, NULL)},
{ "cookie_handler", PTR(uzbl.behave.cookie_handler, STR, 1, cmd_cookie_handler)},
+ { "new_window", PTR(uzbl.behave.new_window, STR, 1, cmd_new_window)},
{ "fifo_dir", PTR(uzbl.behave.fifo_dir, STR, 1, cmd_fifo_dir)},
{ "socket_dir", PTR(uzbl.behave.socket_dir, STR, 1, cmd_socket_dir)},
{ "http_debug", PTR(uzbl.behave.http_debug, INT, 1, cmd_http_debug)},
@@ -1049,6 +1050,12 @@ dehilight (WebKitWebView *page, GArray *argv, GString *result) {
static void
new_window_load_uri (const gchar * uri) {
+ if (uzbl.behave.new_window) {
+ GString *s = g_string_new ("");
+ g_string_printf(s, "'%s'", uri);
+ run_handler(uzbl.behave.new_window, s->str);
+ return;
+ }
GString* to_execute = g_string_new ("");
g_string_append_printf (to_execute, "%s --uri '%s'", uzbl.state.executable_path, uri);
int i;
@@ -1724,6 +1731,19 @@ cmd_cookie_handler() {
}
static void
+cmd_new_window() {
+ gchar **split = g_strsplit(uzbl.behave.new_window, " ", 2);
+ /* pitfall: doesn't handle chain actions; must the sync_ action manually */
+ if ((g_strcmp0(split[0], "sh") == 0) ||
+ (g_strcmp0(split[0], "spawn") == 0)) {
+ g_free (uzbl.behave.new_window);
+ uzbl.behave.new_window =
+ g_strdup_printf("%s %s", split[0], split[1]);
+ }
+ g_strfreev (split);
+}
+
+static void
cmd_fifo_dir() {
uzbl.behave.fifo_dir = init_fifo(uzbl.behave.fifo_dir);
}