From 0c6ca060eef33bae6c2de50ce9918c43f17172f8 Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Thu, 30 Apr 2009 23:31:02 +0200 Subject: multiple character bindings --- examples/configs/sampleconfig | 2 +- examples/configs/sampleconfig-dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index f6e8688..b5d598a 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -26,7 +26,7 @@ m = forward s = stop r = refresh R = reload -h = uri http://www.uzbl.org +gh = uri http://www.uzbl.org f = follow_link_here F = follow_link_new_tab w = follow_link_new_window diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index f6390b8..3953d79 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -26,7 +26,7 @@ m = forward s = stop r = refresh R = reload -h = uri http://www.uzbl.org +gh = uri http://www.uzbl.org f = follow_link_here F = follow_link_new_tab w = follow_link_new_window -- cgit v1.2.3 From 5130922e2024218321c8b49386e20615a8767002 Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Thu, 30 Apr 2009 23:58:56 +0200 Subject: Entering insert mode is now function --- examples/configs/sampleconfig | 1 + examples/configs/sampleconfig-dev | 1 + uzbl.c | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index b5d598a..230ef30 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -34,6 +34,7 @@ w = follow_link_new_window - = zoom_out t = toggle_status k = exit +i = insert_mode B = spawn /bin/bash /usr/share/uzbl/examples/scripts/insert_bookmark.sh u = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_history.sh U = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 3953d79..35e7746 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -34,6 +34,7 @@ w = follow_link_new_window - = zoom_out t = toggle_status k = exit +i = insert_mode B = spawn /bin/bash ./examples/scripts/insert_bookmark.sh u = spawn /bin/bash ./examples/scripts/load_url_from_history.sh U = spawn /bin/bash ./examples/scripts/load_url_from_bookmarks.sh diff --git a/uzbl.c b/uzbl.c index ec16590..f3c6588 100644 --- a/uzbl.c +++ b/uzbl.c @@ -131,6 +131,9 @@ free_action(gpointer action); static Action* new_action(const gchar *name, const gchar *param); +static void +set_insert_mode(WebKitWebView *page, const gchar *param); + /* --- CALLBACKS --- */ @@ -278,6 +281,7 @@ static struct {char *name; Command command;} cmdlist[] = { "toggle_status", toggle_status_cb }, { "spawn", spawn }, { "exit", close_uzbl }, + { "insert_mode", set_insert_mode } }; static void @@ -324,6 +328,15 @@ file_exists (const char * filename) { return false; } +void +set_insert_mode(WebKitWebView *page, const gchar *param) { + (void)page; + (void)param; + + insert_mode = TRUE; + update_title (GTK_WINDOW (main_window)); +} + static void load_uri (WebKitWebView * web_view, const gchar *param) { if (param) { @@ -566,8 +579,8 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) || event->keyval == GDK_Up || event->keyval == GDK_Down || event->keyval == GDK_Left || event->keyval == GDK_Right) return FALSE; - //TURN OFF/ON INSERT MODE - if ((insert_mode && (event->keyval == GDK_Escape)) || (!insert_mode && (event->string[0] == 'i') && !keycmd->len)) { + /* turn of insert mode */ + if (insert_mode && (event->keyval == GDK_Escape)) { insert_mode = !insert_mode || always_insert_mode; update_title (GTK_WINDOW (main_window)); return TRUE; -- cgit v1.2.3 From b73df48c2c4c48c97bdce954669f4f82897da7ec Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 14:35:32 +0200 Subject: scroll stuff, thx to jouz, with slight changes --- examples/configs/sampleconfig | 7 +++++- examples/configs/sampleconfig-dev | 6 ++++- uzbl.c | 51 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 230ef30..2f9df6f 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -21,6 +21,10 @@ show_status = 1 status_top = 0 [bindings] +j = scroll_down +k = scroll_up +h = scroll_left +l = scroll_right b = back m = forward s = stop @@ -33,10 +37,11 @@ w = follow_link_new_window + = zoom_in - = zoom_out t = toggle_status -k = exit +ZZ = exit i = insert_mode B = spawn /bin/bash /usr/share/uzbl/examples/scripts/insert_bookmark.sh u = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_history.sh U = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh + [network] diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 35e7746..9fcc906 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -21,6 +21,10 @@ show_status = 1 status_top = 0 [bindings] +j = scroll_down +k = scroll_up +h = scroll_left +l = scroll_right b = back m = forward s = stop @@ -33,7 +37,7 @@ w = follow_link_new_window + = zoom_in - = zoom_out t = toggle_status -k = exit +ZZ = exit i = insert_mode B = spawn /bin/bash ./examples/scripts/insert_bookmark.sh u = spawn /bin/bash ./examples/scripts/load_url_from_history.sh diff --git a/uzbl.c b/uzbl.c index b767f4d..ca6c6ae 100644 --- a/uzbl.c +++ b/uzbl.c @@ -54,6 +54,10 @@ static GtkWidget* main_window; static GtkWidget* mainbar; static GtkWidget* mainbar_label; +static GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar +static GtkScrollbar* scbar_h; // (These are still hidden) +static GtkAdjustment* bar_v; // Information about document length +static GtkAdjustment* bar_h; // and scrolling position static WebKitWebView* web_view; static gchar* main_title; static gchar selected_url[500] = "\0"; @@ -80,6 +84,8 @@ static gboolean insert_mode = FALSE; static gboolean status_top = FALSE; static gchar* modkey = NULL; static guint modmask = 0; +static gdouble hscroll = 20; +static gdouble vscroll = 20; /* settings from config: group bindings, key -> action */ static GHashTable *bindings; @@ -177,10 +183,45 @@ download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { return (FALSE); } +/* scroll a bar in a given direction */ +static void +scroll (double i, GtkAdjustment* bar) { + gtk_adjustment_set_value (bar, gtk_adjustment_get_value(bar)+i); +} + +static void scroll_up (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (-vscroll, bar_v); +} + +static void scroll_left (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (-hscroll, bar_h); +} + +static void scroll_down (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (vscroll, bar_v); +} + +static void scroll_right (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (hscroll, bar_h); +} + static void toggle_status_cb (WebKitWebView* page, const char *param) { (void)page; (void)param; + if (show_status) { gtk_widget_hide(mainbar); } else { @@ -272,6 +313,10 @@ static struct {char *name; Command command;} cmdlist[] = { { "back", view_go_back }, { "forward", view_go_forward }, + { "scroll_down", scroll_down }, + { "scroll_up", scroll_up }, + { "scroll_left", scroll_left }, + { "scroll_right", scroll_right }, { "reload", view_reload, }, //Buggy { "refresh", view_reload, }, /* for convenience, will change */ { "stop", view_stop_loading, }, @@ -825,6 +870,12 @@ main (int argc, char* argv[]) { printf("window_id %i\n",(int) xwin); printf("pid %i\n", getpid ()); + scbar_v = (GtkScrollbar*) gtk_vscrollbar_new (NULL); + bar_v = gtk_range_get_adjustment((GtkRange*) scbar_v); + scbar_h = (GtkScrollbar*) gtk_hscrollbar_new (NULL); + bar_h = gtk_range_get_adjustment((GtkRange*) scbar_h); + gtk_widget_set_scroll_adjustments ((GtkWidget*) web_view, bar_h, bar_v); + if (!show_status) gtk_widget_hide(mainbar); -- cgit v1.2.3 From 921b5985eb6c5c82ef68fda58cdfce1f3c2f18ce Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 1 May 2009 17:09:12 +0200 Subject: due to socket addition, url is now $6 --- examples/scripts/insert_bookmark.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/scripts/insert_bookmark.sh b/examples/scripts/insert_bookmark.sh index be17c05..5d76c35 100755 --- a/examples/scripts/insert_bookmark.sh +++ b/examples/scripts/insert_bookmark.sh @@ -10,7 +10,7 @@ fi which zenity &>/dev/null || exit 2 -entry=`zenity --entry --text="Add bookmark. add tags at the end, separated by commas" --entry-text="$5"` +entry=`zenity --entry --text="Add bookmark. add tags at the end, separated by commas" --entry-text="$6"` url=`awk '{print $1}' <<< $entry` # TODO: check if already exists, if so, and tags are different: ask if you want to replace tags echo "$entry" >> $file -- cgit v1.2.3 From 8e524576ecbcdb43c21507f2f11441338d117501 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 1 May 2009 17:14:48 +0200 Subject: no more need for /bin/shellname --- TODO | 1 - examples/configs/sampleconfig | 10 +++++----- examples/configs/sampleconfig-dev | 10 +++++----- 3 files changed, 10 insertions(+), 11 deletions(-) (limited to 'examples') diff --git a/TODO b/TODO index 80440a3..2c9f8d1 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,6 @@ ASAP * when launching new instance, don't just try 'uzbl' and then './uzbl', rather launch a new uzbl in the same way the current uzbl instance was started. (same command, same arguments, except --uri) * where to put proxy config? webkit support? depend on libsoup? * compare libsoup to curl backend. there are probably performance differences -* check configured commands if they end on .sh so users don't need to prepend /bin/ * implement a more advanced dmenu alike that behaves like FF's awesomebar and where you can search in url + window title * recognize -h with GOption? * implement a vimperator-like link following scheme. but let user pick his favorite characters to construct the "link identifiers" with. diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 2f9df6f..0f2fa5f 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -11,8 +11,8 @@ # from insert mode by combining them with the modkey [behavior] -history_handler = /bin/bash /usr/share/uzbl/examples/scripts/history.sh -download_handler = /bin/bash /usr/share/uzbl/examples/scripts/download.sh +history_handler = /usr/share/uzbl/examples/scripts/history.sh +download_handler = /usr/share/uzbl/examples/scripts/download.sh fifo_dir = /tmp socket_dir = /tmp always_insert_mode = 0 @@ -39,9 +39,9 @@ w = follow_link_new_window t = toggle_status ZZ = exit i = insert_mode -B = spawn /bin/bash /usr/share/uzbl/examples/scripts/insert_bookmark.sh -u = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_history.sh -U = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh +B = spawn /usr/share/uzbl/examples/scripts/insert_bookmark.sh +u = spawn /usr/share/uzbl/examples/scripts/load_url_from_history.sh +U = spawn /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh [network] diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 9fcc906..7cbf8b4 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -11,8 +11,8 @@ # from insert mode by combining them with the modkey [behavior] -history_handler = /bin/bash ./examples/scripts/history.sh -download_handler = /bin/bash ./examples/scripts/download.sh +history_handler = ./examples/scripts/history.sh +download_handler = ./examples/scripts/download.sh fifo_dir = /tmp socket_dir = /tmp always_insert_mode = 0 @@ -39,8 +39,8 @@ w = follow_link_new_window t = toggle_status ZZ = exit i = insert_mode -B = spawn /bin/bash ./examples/scripts/insert_bookmark.sh -u = spawn /bin/bash ./examples/scripts/load_url_from_history.sh -U = spawn /bin/bash ./examples/scripts/load_url_from_bookmarks.sh +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 [network] -- cgit v1.2.3