aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--examples/configs/sampleconfig-dev1
-rw-r--r--uzbl.c17
-rw-r--r--uzbl.h3
3 files changed, 21 insertions, 0 deletions
diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev
index e9c9cc1..b486660 100644
--- a/examples/configs/sampleconfig-dev
+++ b/examples/configs/sampleconfig-dev
@@ -44,6 +44,7 @@ B = spawn ./examples/scripts/insert_bookmark.sh
u = spawn ./examples/scripts/load_url_from_history.sh
U = spawn ./examples/scripts/load_url_from_bookmarks.sh
#parameter command examples (all need space but can be removed from individual commands). underscore is important.
+/_ = search %s
o _ = uri %s
:wiki _ = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go
gg _ = uri http://www.google.com/search?q=%s
diff --git a/uzbl.c b/uzbl.c
index ffae493..f8cb48f 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -70,6 +70,7 @@ static char fifo_path[64];
static char socket_path[108];
static char executable_path[500];
static GString* keycmd;
+static gchar searchtx[500] = "\0";
/* state variables (initial values coming from command line arguments but may be changed later) */
static gchar* uri = NULL;
@@ -320,6 +321,7 @@ static struct {char *name; Command command;} cmdlist[] =
{ "toggle_status", toggle_status_cb },
{ "spawn", spawn },
{ "exit", close_uzbl },
+ { "search", search_text },
{ "insert_mode", set_insert_mode }
};
@@ -388,6 +390,20 @@ load_uri (WebKitWebView * web_view, const gchar *param) {
}
static void
+search_text (WebKitWebView *page, const char *param) {
+ if ((param) && (param[0] != '\0')) {
+ printf("\nima param!!!\n");
+ strcpy(searchtx, param);
+ }
+ if (searchtx[0] != '\0') {
+ printf ("\n\nsearching: %s\n\n", searchtx);
+ webkit_web_view_mark_text_matches (page, searchtx, FALSE, 0);
+ webkit_web_view_set_highlight_text_matches (page, TRUE);
+ webkit_web_view_search_text (page, searchtx, FALSE, TRUE, TRUE);
+ }
+}
+
+static void
new_window_load_uri (const gchar * uri) {
GString* to_execute = g_string_new ("");
g_string_append_printf (to_execute, "%s --uri '%s'", executable_path, uri);
@@ -742,6 +758,7 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event)
g_string_free (actionparam, TRUE);
g_string_free (parampart, TRUE);
g_string_truncate(keycmd, 0);
+ update_title();
}
g_string_truncate(short_keys, short_keys->len - 1);
diff --git a/uzbl.h b/uzbl.h
index d0d6ec7..f9e3053 100644
--- a/uzbl.h
+++ b/uzbl.h
@@ -116,4 +116,7 @@ add_binding (const gchar *key, const gchar *act);
static void
settings_init ();
+static void
+search_text (WebKitWebView *page, const char *param);
+
/* vi: set et ts=4: */