diff options
author | Barrucadu <mike@barrucadu.co.uk> | 2009-04-25 12:40:19 +0100 |
---|---|---|
committer | Barrucadu <mike@barrucadu.co.uk> | 2009-04-25 12:40:19 +0100 |
commit | 3bae0d6eb4444e29324892bed0bcbf1a4d8066cd (patch) | |
tree | c7dd38b6f4d85ef02c7adcba2f8eaf2a8c3e3697 | |
parent | 98a4cae8b75906b1ef62415e8134c11b509b8668 (diff) | |
parent | a08ab4772758106cf1b6437fd7878206b2f96d84 (diff) |
Merge branch 'master' of git://github.com/Dieterbe/uzbl into dieter/master
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | HOWTO | 2 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | TODO | 10 | ||||
-rw-r--r-- | extra/download.sh | 3 | ||||
-rw-r--r-- | extra/insert_bookmark.sh | 11 | ||||
-rw-r--r-- | extra/load_url_from_bookmarks.sh | 4 | ||||
-rwxr-xr-x | extra/load_url_from_history.sh | 4 | ||||
-rwxr-xr-x | misc/dmenu-performancetest-bench.sh | 17 | ||||
-rwxr-xr-x | misc/dmenu-performancetest-generate-dummy-history-file.sh | 12 | ||||
-rw-r--r-- | sampleconfig | 38 | ||||
-rw-r--r-- | uzbl.c | 40 |
12 files changed, 123 insertions, 23 deletions
@@ -5,4 +5,4 @@ Michael Walker (Barrucadu) <mike@barrucadu.co.uk> - Original threaded FIFO inter Zane Ashby (HashBox) <http://demonastery.org> - Rewrote FIFO interface. Fixed various bugs. -(sentientswitch) - Cleaned up code. Added some commands.
\ No newline at end of file +(sentientswitch) - Cleaned up code. Added some commands. @@ -1,3 +1,3 @@ 1) get the latest code from master branch 2) make -3) profit !
\ No newline at end of file +3) profit ! @@ -21,6 +21,7 @@ Right now uzbl is in a very early state but here are some ideas I would like to -> privoxy looks cool and perfectly demonstrates the unix philosphy. - no download manager. allow user to pick wget/curl/a custom script/... - no build in command interpreters like ubiquity. uzbl should be accessible and you should use a shell or similar. +- no "clear cookies/cache/..." menu items. rm ~/$XDG_{DATA,CACHE}_DIR/uzbl/{cache,cookies}/* - vimperator/konqueror-like hyperlink following. - password management. maybe an encrypted store that unlocks with an ssh key? - use the XDG basedir spec for separation of config, data and cache. and state will be a subdir in the config dir (not part of the spec yet) too. @@ -71,4 +72,4 @@ KNOWN BUGS - Segfault occurs on shutdown, almost definitely FIFO related (I'm not seeing this bug now, but the warning was here when I forked the code and I haven't touched the FIFO bit) - Segfaults when using zoom commands (happens when max zoom already reached?). - Something in the FIFO code causes CPU usage to jump. -- Segfaults when loading aliases from confgi file (currently aliases are defined in the code as a 'work-around').
\ No newline at end of file +- Segfaults when loading aliases from confgi file (currently aliases are defined in the code as a 'work-around'). @@ -1,6 +1,12 @@ * implement all the ideas from README +* Support for arguments to commands (argc/argv-like structure?). +* Support for binding keyboard shortcuts in config file. +* where to put proxy config? webkit support? * do not store the 'http://' part in the history file * improve commandline arguments +* have a better look at /merge the fifo code from barrucadu and friends -* Support for arguments to commands (argc/argv-like structure?). -* Support for binding keyboard shortcuts in config file. + +SOMEDAY: +figure out caching with webkit and in general how we can speed everything +figure out how webkit intercepts key input diff --git a/extra/download.sh b/extra/download.sh new file mode 100644 index 0000000..90d0a9f --- /dev/null +++ b/extra/download.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# $1 = url of file to download +wget $1 diff --git a/extra/insert_bookmark.sh b/extra/insert_bookmark.sh new file mode 100644 index 0000000..3df6086 --- /dev/null +++ b/extra/insert_bookmark.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# $1 should be the uri you want to bookmark +file=bookmarks + +[ -z "$1" ] && exit 1 +which zenity &>/dev/null || exit 2 + +entry=`zenity --entry --text="Add bookmark. add tags at the end, separated by commas" --entry-text="$1"` +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 diff --git a/extra/load_url_from_bookmarks.sh b/extra/load_url_from_bookmarks.sh new file mode 100644 index 0000000..dfbbf9a --- /dev/null +++ b/extra/load_url_from_bookmarks.sh @@ -0,0 +1,4 @@ +#!/bin/bash +file=bookmarks +goto=`awk '{print $1}' $history_file | dmenu` #NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes. +[ -n "$goto" ] && echo "uri $goto" > /tmp/uzbl-fifo-name-TODO diff --git a/extra/load_url_from_history.sh b/extra/load_url_from_history.sh new file mode 100755 index 0000000..bcc2362 --- /dev/null +++ b/extra/load_url_from_history.sh @@ -0,0 +1,4 @@ +#!/bin/bash +history_file=/tmp/uzbl.history +goto=`awk '{print $3}' $history_file | sort | uniq | dmenu` +[ -n "$goto" ] && echo "uri $goto" > /tmp/uzbl-fifo-name-TODO diff --git a/misc/dmenu-performancetest-bench.sh b/misc/dmenu-performancetest-bench.sh new file mode 100755 index 0000000..c06df46 --- /dev/null +++ b/misc/dmenu-performancetest-bench.sh @@ -0,0 +1,17 @@ +#!/bin/bash +echo "Run this test more then once. the first read on the file may be uncached. after that, the file is in Linux' block cache" + +echo "Plain awk '{print \$3}':" +time awk '{print $3}' dummy_history_file >/dev/null + +echo "awk + sort" +time awk '{print $3}' dummy_history_file | sort >/dev/null +echo "awk + sort + uniq" +time awk '{print $3}' dummy_history_file | sort | uniq >/dev/null + +echo "Plain dmenu:" +dmenu < dummy_history_file +echo "awked into dmenu:" +awk '{print $3}' dummy_history_file | dmenu +echo "awk + sort + uniq into dmenu:" +awk '{print $3}' dummy_history_file | sort | uniq | dmenu diff --git a/misc/dmenu-performancetest-generate-dummy-history-file.sh b/misc/dmenu-performancetest-generate-dummy-history-file.sh new file mode 100755 index 0000000..17566bd --- /dev/null +++ b/misc/dmenu-performancetest-generate-dummy-history-file.sh @@ -0,0 +1,12 @@ +#!/bin/bash +echo "Creating dummy file of 50MB in size (625000 entries of 80chars)" +echo "Note: this takes about an hour and a half" +entries_per_iteration=1000 +for i in `seq 1 625` +do + echo "Iteration $i of 625 ( $entries_per_iteration each )" + for j in `seq 1 $entries_per_iteration` + do + echo "`date +'%Y-%m-%d %H:%M:%S'` `date +%s`abcdefhijklmno`date +%s | md5sum`" >> ./dummy_history_file + done +done diff --git a/sampleconfig b/sampleconfig new file mode 100644 index 0000000..4d25674 --- /dev/null +++ b/sampleconfig @@ -0,0 +1,38 @@ +# example uzbl config. in a real config, we should obey the xdg spec + +# all keys in the behavior group are optional. if not set, the corresponding behavior is disabed. +# bindings_internal denote keys to trigger actions internally in uzbl +# bindings_external denote keys to trigger scripts outside uzbl + +# keyboard behavior is vimstyle by default (all actions -> 1 key). set +# always_insert_mode to always be in insert mode and disable going out of it. +# if you do this, make sure you've set a modkey so you can reach the actions +# from insert mode by combining them with the modkey + +[behavior] +history_file = /tmp/uzbl.history +download_handler = ./extra/download.sh +fifo_dir = /tmp +always_insert_mode = 0 +modkey = Mod4 + +[bindings_internal] +next = n +follow_link_here = f +follow_link_new_tab = F +follow_link_new_window = w + +[bindings_external] +./extra/insert_bookmark.sh = b +./extra/load_url_from_history.sh = u +./extra/load_url_from_bookmarks.sh = U + +[alias] +b = back +f = forward +z+ = zoom in +z- = zoom out +r = refresh +s = stop + +[network] @@ -47,12 +47,14 @@ static GtkWidget* main_window; static GtkWidget* modeline; static WebKitWebView* web_view; -static gchar* history_file; -static gchar* home_page; -static gchar* uri = NULL; -static gchar* fifodir = NULL; -static char fifopath[64]; -static bool modevis = FALSE; +static gchar* history_file; +static gchar* home_page; +static gchar* uri = NULL; +static gchar* fifodir = NULL; +static char fifopath[64]; +static bool modevis = FALSE; +static gboolean verbose = FALSE; +static Window xwin = NULL; static GOptionEntry entries[] = { @@ -85,7 +87,7 @@ static bool parse_modeline (GtkWidget* mode, GdkEventKey* event) { if ((event->type==GDK_KEY_PRESS) && (event->keyval==GDK_Return)) parse_command (gtk_entry_get_text (modeline)); - + return false; } @@ -93,22 +95,22 @@ static void log_history_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer { strncpy (uri, webkit_web_frame_get_uri (frame), strlen (webkit_web_frame_get_uri (frame))); - FILE * output_file = fopen (history_file, "a"); + FILE * output_file = fopen(history_file, "a"); if (output_file == NULL) { - fprintf (stderr, "Cannot open %s for logging\n", history_file); + fprintf(stderr, "Cannot open %s for logging\n", history_file); } else { time_t rawtime; struct tm * timeinfo; char buffer [80]; - time (&rawtime); - timeinfo = localtime (&rawtime); + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); strftime (buffer,80,"%Y-%m-%d %H:%M:%S",timeinfo); - fprintf (output_file, "%s %s\n",buffer, uri); - fclose (output_file); + fprintf(output_file, "%s %s\n",buffer, uri); + fclose(output_file); } } @@ -117,7 +119,7 @@ static void toggle_command_mode () if (modevis) { gtk_widget_hide (modeline); - gtk_widget_grab_default (modeline); + gtk_widget_grab_focus (web_view); } else { @@ -272,7 +274,7 @@ static void add_command_alias (char* alias, char* command) numalias++; } -static bool setup_gtk (int argc, char* argv[]) +static void setup_gtk (int argc, char* argv[]) { gtk_init (&argc, &argv); @@ -298,8 +300,7 @@ static bool setup_gtk (int argc, char* argv[]) gtk_widget_grab_focus (GTK_WIDGET (web_view)); gtk_widget_show_all (main_window); gtk_widget_hide(modeline); - - return true; + gtk_widget_grab_focus (GTK_WIDGET (web_view)); } static void setup_commands () @@ -324,7 +325,7 @@ static void setup_threading () static void setup_settings () { GKeyFile* config = g_key_file_new (); - gboolean res = g_key_file_load_from_file (config, "./config", G_KEY_FILE_NONE, NULL); //TODO: pass config file as argument + gboolean res = g_key_file_load_from_file (config, "./sampleconfig", G_KEY_FILE_NONE, NULL); //TODO: pass config file as argument if (res) { @@ -387,6 +388,9 @@ int main (int argc, char* argv[]) if (!g_thread_supported ()) g_thread_init (NULL); + xwin = GDK_WINDOW_XID (GTK_WIDGET (main_window)->window); + printf("My X window id is %i\n",(int) xwin); + setup_settings (); setup_gtk (argc, argv); setup_commands (); |