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 --- uzbl.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index a48849c..ec16590 100644 --- a/uzbl.c +++ b/uzbl.c @@ -61,6 +61,7 @@ static gint load_progress; static Window xwin = 0; static char fifo_path[64]; static char socket_path[108]; +static GString *keycmd; /* state variables (initial values coming from command line arguments but may be changed later) */ static gchar* uri = NULL; @@ -522,6 +523,8 @@ static void update_title (GtkWindow* window) { GString* string_long = g_string_new (""); GString* string_short = g_string_new (""); + + g_string_append_printf(string_long, "%s ", keycmd->str); if (!always_insert_mode) g_string_append (string_long, (insert_mode ? "[I] " : "[C] ")); if (main_title) { @@ -564,18 +567,35 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) return FALSE; //TURN OFF/ON INSERT MODE - if ((insert_mode && (event->keyval == GDK_Escape)) || (!insert_mode && (event->string[0] == 'i'))) { + if ((insert_mode && (event->keyval == GDK_Escape)) || (!insert_mode && (event->string[0] == 'i') && !keycmd->len)) { insert_mode = !insert_mode || always_insert_mode; update_title (GTK_WINDOW (main_window)); return TRUE; } - if ((!insert_mode || (event->state == modmask)) && (action = g_hash_table_lookup(bindings, event->string))) { - parse_command(action->name, action->param); + if (insert_mode && event->state != modmask) + return FALSE; + + + if (event->keyval == GDK_Escape) { + g_string_truncate(keycmd, 0); + + update_title (GTK_WINDOW (main_window)); + return TRUE; } - return !insert_mode; + g_string_append(keycmd, event->string); + + if ((action = g_hash_table_lookup(bindings, keycmd->str))) { + g_string_truncate(keycmd, 0); + + parse_command(action->name, action->param); + } + + update_title (GTK_WINDOW (main_window)); + + return TRUE; } static GtkWidget* @@ -765,6 +785,8 @@ main (int argc, char* argv[]) { /* initialize hash table */ bindings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_action); + keycmd = g_string_new(""); + settings_init (); commands_hash (); @@ -797,6 +819,8 @@ main (int argc, char* argv[]) { gtk_main (); + g_string_free(keycmd, TRUE); + unlink (socket_path); unlink (fifo_path); -- 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 'uzbl.c') 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 b7ce9e7cc63dba46ec0a83bb281e153874c5a388 Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 00:02:13 +0200 Subject: make update_title parameterless func --- uzbl.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index f3c6588..016f66a 100644 --- a/uzbl.c +++ b/uzbl.c @@ -108,7 +108,7 @@ static char *XDG_CONFIG_HOME_default[256]; static char *XDG_CONFIG_DIRS_default = "/etc/xdg"; static void -update_title (GtkWindow* window); +update_title(void); static void load_uri ( WebKitWebView * web_view, const gchar * uri); @@ -187,7 +187,7 @@ toggle_status_cb (WebKitWebView* page, const char *param) { gtk_widget_show(mainbar); } show_status = !show_status; - update_title (GTK_WINDOW (main_window)); + update_title(); } static void @@ -200,7 +200,7 @@ link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpoin if (link) { strcpy (selected_url, link); } - update_title (GTK_WINDOW (main_window)); + update_title(); } static void @@ -211,7 +211,7 @@ title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar if (main_title) g_free (main_title); main_title = g_strdup (title); - update_title (GTK_WINDOW (main_window)); + update_title(); } static void @@ -219,7 +219,7 @@ progress_change_cb (WebKitWebView* page, gint progress, gpointer data) { (void) page; (void) data; load_progress = progress; - update_title (GTK_WINDOW (main_window)); + update_title(); } static void @@ -334,7 +334,7 @@ set_insert_mode(WebKitWebView *page, const gchar *param) { (void)param; insert_mode = TRUE; - update_title (GTK_WINDOW (main_window)); + update_title(); } static void @@ -533,7 +533,7 @@ setup_threading () { } static void -update_title (GtkWindow* window) { +update_title (void) { GString* string_long = g_string_new (""); GString* string_short = g_string_new (""); @@ -557,10 +557,10 @@ update_title (GtkWindow* window) { gchar* title_short = g_string_free (string_short, FALSE); if (show_status) { - gtk_window_set_title (window, title_short); + gtk_window_set_title (GTK_WINDOW(main_window), title_short); gtk_label_set_text(GTK_LABEL(mainbar_label), title_long); } else { - gtk_window_set_title (window, title_long); + gtk_window_set_title (GTK_WINDOW(main_window), title_long); } g_free (title_long); @@ -582,7 +582,7 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) /* turn of insert mode */ if (insert_mode && (event->keyval == GDK_Escape)) { insert_mode = !insert_mode || always_insert_mode; - update_title (GTK_WINDOW (main_window)); + update_title(); return TRUE; } @@ -593,7 +593,7 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) if (event->keyval == GDK_Escape) { g_string_truncate(keycmd, 0); - update_title (GTK_WINDOW (main_window)); + update_title(); return TRUE; } @@ -606,7 +606,7 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) parse_command(action->name, action->param); } - update_title (GTK_WINDOW (main_window)); + update_title(); return TRUE; } -- cgit v1.2.3 From d41e70ea0e1bf7d7a5154cae75ba8f5639633bee Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 00:20:40 +0200 Subject: Code simplification in insert_mode handling --- uzbl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 016f66a..5493a59 100644 --- a/uzbl.c +++ b/uzbl.c @@ -579,9 +579,9 @@ 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 of insert mode */ + /* turn off insert mode (if always_insert_mode is not used) */ if (insert_mode && (event->keyval == GDK_Escape)) { - insert_mode = !insert_mode || always_insert_mode; + insert_mode = always_insert_mode; update_title(); return TRUE; } -- cgit v1.2.3 From 5850fa6e96823b56e60caf317a2531ff48ee1e62 Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 00:37:29 +0200 Subject: Control thread wasn't detached --- uzbl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 5493a59..b767f4d 100644 --- a/uzbl.c +++ b/uzbl.c @@ -530,6 +530,7 @@ static void setup_threading () { pthread_t control_thread; pthread_create(&control_thread, NULL, control_socket, NULL); + pthread_detach(control_thread); } static void -- 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 'uzbl.c') 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 8ba87ad7653bff70bf44106dc1e3fe1d3e99d9f0 Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Fri, 1 May 2009 15:04:44 +0100 Subject: Moved structs/function primitives to uzbl.h file, so we no longer need the growing collection of function primitives near the top of uzbl.c. Also tidied up a bit of the code a little. --- uzbl.c | 71 ++++++++++++------------------------------- uzbl.h | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 52 deletions(-) create mode 100644 uzbl.h (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 016f66a..eec7097 100644 --- a/uzbl.c +++ b/uzbl.c @@ -35,33 +35,34 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include -#include -#include #include #include #include #include -#include #include -#include -#include + +#include "uzbl.h" /* housekeeping / internal variables */ -static GtkWidget* main_window; -static GtkWidget* mainbar; -static GtkWidget* mainbar_label; +static GtkWidget* main_window; +static GtkWidget* mainbar; +static GtkWidget* mainbar_label; static WebKitWebView* web_view; -static gchar* main_title; -static gchar selected_url[500] = "\0"; -static gint load_progress; -static Window xwin = 0; -static char fifo_path[64]; -static char socket_path[108]; -static GString *keycmd; +static gchar* main_title; +static gchar selected_url[500] = "\0"; +static gint load_progress; +static Window xwin = 0; +static char fifo_path[64]; +static char socket_path[108]; +static GString* keycmd; /* state variables (initial values coming from command line arguments but may be changed later) */ static gchar* uri = NULL; @@ -82,15 +83,10 @@ static gchar* modkey = NULL; static guint modmask = 0; /* settings from config: group bindings, key -> action */ -static GHashTable *bindings; +static GHashTable* bindings; /* command list: name -> Command */ -static GHashTable *commands; - -typedef struct { - char *name; - char *param; -} Action; +static GHashTable* commands; /* commandline arguments (set initial values for the state variables) */ static GOptionEntry entries[] = @@ -107,35 +103,6 @@ typedef void (*Command)(WebKitWebView*, const char *); static char *XDG_CONFIG_HOME_default[256]; static char *XDG_CONFIG_DIRS_default = "/etc/xdg"; -static void -update_title(void); - -static void -load_uri ( WebKitWebView * web_view, const gchar * uri); - -static void -new_window_load_uri (const gchar * uri); - -static void -close_uzbl (WebKitWebView *page, const char *param); - -static gboolean -run_command(const char *command, const char *args); - -static void -spawn(WebKitWebView *web_view, const char *param); - -static void -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 --- */ static gboolean @@ -728,7 +695,7 @@ settings_init () { modkey = g_key_file_get_value (config, "behavior", "modkey", NULL); status_top = g_key_file_get_boolean (config, "behavior", "status_top", NULL); if (! fifo_dir) - fifo_dir = g_key_file_get_value (config, "behavior", "fifodir", NULL); + fifo_dir = g_key_file_get_value (config, "behavior", "fifo_dir", NULL); if (! socket_dir) socket_dir = g_key_file_get_value (config, "behavior", "socket_dir", NULL); keys = g_key_file_get_keys (config, "bindings", NULL, NULL); diff --git a/uzbl.h b/uzbl.h new file mode 100644 index 0000000..7cd35c8 --- /dev/null +++ b/uzbl.h @@ -0,0 +1,106 @@ +typedef struct { + char* name; + char* param; +} Action; + + +static gboolean +new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data); + +WebKitWebView* +create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data); + +static gboolean +download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data); + +static void +toggle_status_cb (WebKitWebView* page, const char *param); + +static void +link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data); + +static void +title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data); + +static void +progress_change_cb (WebKitWebView* page, gint progress, gpointer data); + +static void +load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data); + +static void +destroy_cb (GtkWidget* widget, gpointer data); + +static void +log_history_cb (); + +static void +commands_hash(void); + +void +free_action(gpointer act); + +Action* +new_action(const gchar *name, const gchar *param); + +static bool +file_exists (const char * filename); + +void +set_insert_mode(WebKitWebView *page, const gchar *param); + +static void +load_uri (WebKitWebView * web_view, const gchar *param); + +static void +new_window_load_uri (const gchar * uri); + +static void +close_uzbl (WebKitWebView *page, const char *param); + +static gboolean +run_command(const char *command, const char *args); + +static void +spawn(WebKitWebView *web_view, const char *param); + +static void +parse_command(const char *cmd, const char *param); + +static void +parse_line(char *line); + +static void +control_fifo(GIOChannel *fd); + +static void +create_fifo(); + +static void +*control_socket(); + +static void +setup_threading (); + +static void +update_title (void); + +static gboolean +key_press_cb (WebKitWebView* page, GdkEventKey* event); + +static GtkWidget* +create_browser (); + +static GtkWidget* +create_mainbar (); + +static +GtkWidget* create_window (); + +static void +add_binding (const gchar *key, const gchar *act); + +static void +settings_init (); + +/* vi: set et ts=4: */ -- cgit v1.2.3 From 73130c8b21549668c7af582cbed8d1af4a67ee4e Mon Sep 17 00:00:00 2001 From: dusanx Date: Fri, 1 May 2009 18:14:09 +0200 Subject: Open in new window, all parameters forwarded --- uzbl.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index a48849c..bed83c8 100644 --- a/uzbl.c +++ b/uzbl.c @@ -61,6 +61,7 @@ static gint load_progress; static Window xwin = 0; static char fifo_path[64]; static char socket_path[108]; +static char executable_path[500]; /* state variables (initial values coming from command line arguments but may be changed later) */ static gchar* uri = NULL; @@ -337,21 +338,18 @@ load_uri (WebKitWebView * web_view, const gchar *param) { static void new_window_load_uri (const gchar * uri) { GString* to_execute = g_string_new (""); - if (!config_file) { - g_string_printf (to_execute, "uzbl --uri '%s'", uri); - } else { - g_string_printf (to_execute, "uzbl --uri '%s' --config '%s'", uri, config_file); - } - printf("Spawning %s\n",to_execute->str); - if (!g_spawn_command_line_async (to_execute->str, NULL)) { - if (!config_file) { - g_string_printf (to_execute, "./uzbl --uri '%s'", uri); - } else { - g_string_printf (to_execute, "./uzbl --uri '%s' --config '%s'", uri, config_file); + g_string_append_printf (to_execute, "%s --uri '%s'", executable_path, uri); + int i; + for (i = 0; entries[i].long_name != NULL; i++) { + if ((entries[i].arg == G_OPTION_ARG_STRING) && (strcmp(entries[i].long_name,"uri")!=0)) { + gchar** str = (gchar**)entries[i].arg_data; + if (*str!=NULL) { + g_string_append_printf (to_execute, " --%s '%s'", entries[i].long_name, *str); + } } - printf("Spawning %s\n",to_execute->str); - g_spawn_command_line_async (to_execute->str, NULL); } + printf("\n%s\n", to_execute->str); + g_spawn_command_line_async (to_execute->str, NULL); g_string_free (to_execute, TRUE); } @@ -753,6 +751,7 @@ main (int argc, char* argv[]) { g_thread_init (NULL); printf("Uzbl start location: %s\n", argv[0]); + strcpy(executable_path,argv[0]); strcat ((char *) XDG_CONFIG_HOME_default, getenv ("HOME")); strcat ((char *) XDG_CONFIG_HOME_default, "/.config"); -- cgit v1.2.3 From 563ad7c4aac83e7311ce6f16b26c983486a78cf0 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 1 May 2009 18:38:38 +0200 Subject: fix for broken bookmark script. we cannot add arbitrary arguments to keybound commands anymore, so we must add them by default to all run_command things --- README | 9 ++++----- uzbl.c | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'uzbl.c') diff --git a/README b/README index 31f307a..6c1b23f 100644 --- a/README +++ b/README @@ -106,18 +106,17 @@ $2 uzbl-pid $3 uzbl-x-window-id $4 uzbl_fifo-filename $5 uzbl_socket-filename +$6 current page url +$7 current page title .. [ script specific ] (optional) The script specific arguments are this: * history: - $6 page url - $7 page title $8 date of visit (Y-m-d H:i:s localtime) * add bookmark: - $6 page url - $7 page title + none * download: - $6 url + $8 url of item to download KNOWN BUGS - Segfaults when using zoom commands (happens when max zoom already reached?). diff --git a/uzbl.c b/uzbl.c index ca6c6ae..d5bdb91 100644 --- a/uzbl.c +++ b/uzbl.c @@ -289,7 +289,7 @@ log_history_cb () { timeinfo = localtime ( &rawtime ); strftime (date, 80, "%Y-%m-%d %H:%M:%S", timeinfo); GString* args = g_string_new (""); - g_string_printf (args, "'%s' '%s' '%s'", uri, "TODO:page title here", date); + g_string_printf (args, "'%s'", date); run_command(history_handler, args->str); g_string_free (args, TRUE); } @@ -428,6 +428,7 @@ run_command(const char *command, const char *args) { GString* to_execute = g_string_new (""); gboolean result; g_string_printf (to_execute, "%s '%s' '%i' '%i' '%s' '%s'", command, config_file, (int) getpid() , (int) xwin, fifo_path, socket_path); + g_string_append_printf (to_execute, " '%s' '%s'", uri, "TODO title here"); if(args) { g_string_append_printf (to_execute, " %s", args); } -- cgit v1.2.3