diff options
author | 2009-05-16 14:11:33 +0200 | |
---|---|---|
committer | 2009-05-16 14:11:33 +0200 | |
commit | 67160e8918ddca8792db46be96e11ce45896df98 (patch) | |
tree | e87aa84d34edf9face84849df93967f251bc94e0 | |
parent | 242051ada8f13f347ef467007cbcf1290b67f317 (diff) |
make handlers working in sample config, pass correct page titles to scripts, in example scripts: save page titles, and if dmenu-vertical is found show more stuff (date, page title, bookmark tags,..) + small stuff
-rw-r--r-- | examples/configs/sampleconfig-dev | 6 | ||||
-rwxr-xr-x | examples/scripts/history.sh | 2 | ||||
-rwxr-xr-x | examples/scripts/insert_bookmark.sh | 17 | ||||
-rwxr-xr-x | examples/scripts/load_url_from_bookmarks.sh | 19 | ||||
-rwxr-xr-x | examples/scripts/load_url_from_history.sh | 13 | ||||
-rw-r--r-- | uzbl.c | 6 |
6 files changed, 35 insertions, 28 deletions
diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index fc8bf87..d196c92 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -8,9 +8,9 @@ # from insert mode by combining them with the modkey # TODO: ability to attach misc things (spawn <foo>, script <bar>,.. to internal events) -set history_handler = ./examples/scripts/history.sh -set download_handler = ./examples/scripts/download.sh -set cookie_handler = ./examples/scripts/cookies.sh +set history_handler = ./examples/scripts/history.sh +set download_handler = ./examples/scripts/download.sh +set cookie_handler = ./examples/scripts/cookies.sh diff --git a/examples/scripts/history.sh b/examples/scripts/history.sh index b6671fe..19b5218 100755 --- a/examples/scripts/history.sh +++ b/examples/scripts/history.sh @@ -1,4 +1,4 @@ #!/bin/bash #TODO: strip 'http://' part # you probably really want this in your $XDG_DATA_HOME (eg $HOME/.local/share/uzbl/history) -echo "$8 $6" >> /tmp/uzbl.history +echo "$8 $6 $7" >> /tmp/uzbl.history diff --git a/examples/scripts/insert_bookmark.sh b/examples/scripts/insert_bookmark.sh index fe18328..180f4cd 100755 --- a/examples/scripts/insert_bookmark.sh +++ b/examples/scripts/insert_bookmark.sh @@ -1,16 +1,17 @@ #!/bin/bash # you probably want your bookmarks file in your $XDG_DATA_HOME ( eg $HOME/.local/share/uzbl/bookmarks) -if [ -f /usr/share/uzbl/examples/data/bookmarks ] -then - file=/usr/share/uzbl/examples/data/bookmarks # you will probably get permission denied errors here. pick a file in your ~ -else - file=./examples/data/bookmarks #useful when developing -fi + +[ -f /usr/share/uzbl/examples/data/bookmarks ] && file=/usr/share/uzbl/examples/data/bookmarks # you will probably get permission denied errors here. +[ -f $XDG_DATA_HOME/uzbl/bookmarks ] && file=$XDG_DATA_HOME/uzbl/bookmarks +[ -f ./examples/data/bookmarks ] && file=./examples/data/bookmarks #useful when developing +[ -z "$file" ] && exit 1 which zenity &>/dev/null || exit 2 -entry=`zenity --entry --text="Add bookmark. add tags at the end, separated by commas" --entry-text="$6"` +entry=`zenity --entry --text="Add bookmark. add tags after the '\t', separated by spaces" --entry-text="$6 $7\t"` 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 +echo "$entry" >/dev/null #for some reason we need this.. don't ask me why +echo -e "$entry" >> $file +true
\ No newline at end of file diff --git a/examples/scripts/load_url_from_bookmarks.sh b/examples/scripts/load_url_from_bookmarks.sh index 2d19067..5ceb52e 100755 --- a/examples/scripts/load_url_from_bookmarks.sh +++ b/examples/scripts/load_url_from_bookmarks.sh @@ -1,19 +1,22 @@ #!/bin/bash +#NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes. + +[ -f /usr/share/uzbl/examples/data/bookmarks ] && file=/usr/share/uzbl/examples/data/bookmarks +[ -f $XDG_DATA_HOME/uzbl/bookmarks ] && file=$XDG_DATA_HOME/uzbl/bookmarks +[ -f ./examples/data/bookmarks ] && file=./examples/data/bookmarks #useful when developing +[ -z "$file" ] && exit 1 + if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]' then DMENU="dmenu -i -xs -rs -l 10" # vertical patch + # show tags as well + goto=`$DMENU < $file | awk '{print $1}'` else DMENU="dmenu -i" -fi -# you probably want your bookmarks file in your $XDG_DATA_HOME ( eg $HOME/.local/share/uzbl/bookmarks) -if [ -f /usr/share/uzbl/examples/data/bookmarks ] -then - file=/usr/share/uzbl/examples/data/bookmarks -else - file=./examples/data/bookmarks #useful when developing + # because they are all after each other, just show the url, not their tags. + goto=`awk '{print $1}' $file | $DMENU` fi -goto=`awk '{print $1}' $file | $DMENU` #NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes. #[ -n "$goto" ] && echo "cmd uri $goto" > $4 [ -n "$goto" ] && uzblctrl -s $5 -c "cmd uri $goto" diff --git a/examples/scripts/load_url_from_history.sh b/examples/scripts/load_url_from_history.sh index 9dd56d2..f79a058 100755 --- a/examples/scripts/load_url_from_history.sh +++ b/examples/scripts/load_url_from_history.sh @@ -2,17 +2,20 @@ # you probably really want this in your $XDG_DATA_HOME (eg $HOME/.local/share/uzbl/history) history_file=/tmp/uzbl.history +# choose from all entries, sorted and uniqued +# goto=`awk '{print $3}' $history_file | sort -u | dmenu -i` + + if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]' then DMENU="dmenu -i -xs -rs -l 10" # vertical patch + # choose an item in reverse order, showing also the date and page titles + goto=`tac $history_file | $DMENU | awk '{print $3}'` else DMENU="dmenu -i" + # choose from all entries (no date or title), the first one being current url, and after that all others, sorted and uniqued, in ascending order + current=`tail -n 1 $history_file | awk '{print $3}'`; goto=`(echo $current; awk '{print $3}' $history_file | grep -v "^$current\$" | sort -u) | $DMENU` fi -# choose from all entries, sorted and uniqued -# goto=`awk '{print $3}' $history_file | sort -u | dmenu -i` - -# choose from all entries, the first one being current url, and after that all others, sorted and uniqued. -current=`tail -n 1 $history_file | awk '{print $3}'`; goto=`(echo $current; awk '{print $3}' $history_file | grep -v "^$current\$" | sort -u) | $DMENU` #[ -n "$goto" ] && echo "cmd uri $goto" > $4 [ -n "$goto" ] && uzblctrl -s $5 -c "cmd uri $goto" @@ -712,7 +712,7 @@ run_command_async(const char *command, const char *args) { command, uzbl.state.config_file, (int) getpid() , (int) uzbl.xwin, uzbl.comm.fifo_path, uzbl.comm.socket_path); g_string_append_printf (to_execute, " '%s' '%s'", - uzbl.state.uri, "TODO title here"); + uzbl.state.uri, uzbl.gui.main_title); if(args) { g_string_append_printf (to_execute, " %s", args); } @@ -728,7 +728,7 @@ run_command_sync(const char *command, const char *args, char **stdout) { GString* to_execute = g_string_new (""); gboolean result; g_string_printf (to_execute, "%s '%s' '%i' '%i' '%s' '%s'", command, uzbl.state.config_file, (int) getpid() , (int) uzbl.xwin, uzbl.comm.fifo_path, uzbl.comm.socket_path); - g_string_append_printf (to_execute, " '%s' '%s'", uzbl.state.uri, "TODO title here"); + g_string_append_printf (to_execute, " '%s' '%s'", uzbl.state.uri, uzbl.gui.main_title); if(args) { g_string_append_printf (to_execute, " %s", args); } @@ -1371,7 +1371,7 @@ create_browser () { g_signal_connect (G_OBJECT (g->web_view), "title-changed", G_CALLBACK (title_change_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "load-committed", G_CALLBACK (load_commit_cb), g->web_view); - g_signal_connect (G_OBJECT (g->web_view), "load-committed", G_CALLBACK (log_history_cb), g->web_view); + g_signal_connect (G_OBJECT (g->web_view), "load-finished", G_CALLBACK (log_history_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "load-finished", G_CALLBACK (load_finish_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "key-press-event", G_CALLBACK (key_press_cb), g->web_view); |