diff options
-rw-r--r-- | examples/config/uzbl/config | 4 | ||||
-rw-r--r-- | uzbl.c | 20 | ||||
-rw-r--r-- | uzbl.h | 4 |
3 files changed, 28 insertions, 0 deletions
diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index a4a5f45..3c2b7bf 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -11,6 +11,10 @@ set history_handler = spawn $XDG_DATA_HOME/uzbl/scripts/history.sh set download_handler = spawn $XDG_DATA_HOME/uzbl/scripts/download.sh set cookie_handler = spawn $XDG_DATA_HOME/uzbl/scripts/cookies.py +# Control how new windows should open +#set new_window = sh 'uzbl -u $8' # equivalent to the default behaviour +#set new_window = sh 'echo uri "$8" > $4' # open in same window + # You can bind whatever things (spawn <foo>, script <bar>,..) to some events TODO: make events system more generic set load_start_handler = set status_message = <span foreground="khaki">wait</span> set load_commit_handler = set status_message = <span foreground="green">recv</span> @@ -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); } @@ -137,6 +137,7 @@ typedef struct { gchar* socket_dir; gchar* download_handler; gchar* cookie_handler; + gchar* new_window; gboolean always_insert_mode; gboolean show_status; gboolean insert_mode; @@ -494,6 +495,9 @@ static void cmd_cookie_handler(); static void +cmd_new_window(); + +static void move_statusbar(); static void |