From e04b4d1628000f185e4499c0bdd9d5a5a610fd15 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Mon, 27 Apr 2009 21:25:35 +0200 Subject: reorganize/refactor example scripts/config / bookmark file etc so that its easier for new users + separate config for development --- examples/bookmarks | 4 +++ examples/configs/sampleconfig | 41 +++++++++++++++++++++++++++++ examples/configs/sampleconfig-dev | 41 +++++++++++++++++++++++++++++ examples/scripts/download.sh | 2 ++ examples/scripts/history.sh | 4 +++ examples/scripts/insert_bookmark.sh | 15 +++++++++++ examples/scripts/load_url_from_bookmarks.sh | 12 +++++++++ examples/scripts/load_url_from_history.sh | 6 +++++ 8 files changed, 125 insertions(+) create mode 100644 examples/bookmarks create mode 100644 examples/configs/sampleconfig create mode 100644 examples/configs/sampleconfig-dev create mode 100755 examples/scripts/download.sh create mode 100755 examples/scripts/history.sh create mode 100755 examples/scripts/insert_bookmark.sh create mode 100755 examples/scripts/load_url_from_bookmarks.sh create mode 100755 examples/scripts/load_url_from_history.sh (limited to 'examples') diff --git a/examples/bookmarks b/examples/bookmarks new file mode 100644 index 0000000..13fcd48 --- /dev/null +++ b/examples/bookmarks @@ -0,0 +1,4 @@ +http://www.archlinux.org linux arch +http://www.uzbl.org uzbl browser +http://dieter.plaetinck.be uzbl +http://www.icanhascheezburger.com lolcats fun diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig new file mode 100644 index 0000000..b92acc2 --- /dev/null +++ b/examples/configs/sampleconfig @@ -0,0 +1,41 @@ + +# 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_handler = /bin/bash /usr/share/uzbl/examples/scripts/history.sh +download_handler = /bin/bash /usr/share/uzbl/examples/scripts/download.sh +fifo_dir = /tmp +always_insert_mode = 0 +modkey = Mod1 +show_status = 1 +status_top = 0 + +[bindings_internal] +back = b +forward = m +stop = s +refresh = r +reload = R +home = h +follow_link_here = f +follow_link_new_tab = F +follow_link_new_window = w +zoom_in = + +zoom_out = - +toggle_status = t + +[bindings_external] +/bin/bash /usr/share/uzbl/examples/scripts/insert_bookmark.sh = B +/bin/bash /usr/share/uzbl/examples/scripts/load_url_from_history.sh = u +/bin/bash /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh = U + +[network] diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev new file mode 100644 index 0000000..f7f3bb7 --- /dev/null +++ b/examples/configs/sampleconfig-dev @@ -0,0 +1,41 @@ + +# 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_handler = /bin/bash ./examples/scripts/history.sh +download_handler = /bin/bash ./examples/scripts/download.sh +fifo_dir = /tmp +always_insert_mode = 0 +modkey = Mod1 +show_status = 1 +status_top = 0 + +[bindings_internal] +back = b +forward = m +stop = s +refresh = r +reload = R +home = h +follow_link_here = f +follow_link_new_tab = F +follow_link_new_window = w +zoom_in = + +zoom_out = - +toggle_status = t + +[bindings_external] +/bin/bash ./examples/scripts/insert_bookmark.sh = B +/bin/bash ./examples/scripts/load_url_from_history.sh = u +/bin/bash ./examples/scripts/load_url_from_bookmarks.sh = U + +[network] diff --git a/examples/scripts/download.sh b/examples/scripts/download.sh new file mode 100755 index 0000000..ff3d8db --- /dev/null +++ b/examples/scripts/download.sh @@ -0,0 +1,2 @@ +#!/bin/bash +wget $5 diff --git a/examples/scripts/history.sh b/examples/scripts/history.sh new file mode 100755 index 0000000..03c568a --- /dev/null +++ b/examples/scripts/history.sh @@ -0,0 +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 "$7 $5" >> /tmp/uzbl.history diff --git a/examples/scripts/insert_bookmark.sh b/examples/scripts/insert_bookmark.sh new file mode 100755 index 0000000..af6ca8a --- /dev/null +++ b/examples/scripts/insert_bookmark.sh @@ -0,0 +1,15 @@ +#!/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/bookmarks ] +then + file=/usr/share/uzbl/examples/bookmarks +else + file=./examples/bookmarks #useful when developing +fi + +which zenity &>/dev/null || exit 2 + +entry=`zenity --entry --text="Add bookmark. add tags at the end, separated by commas" --entry-text="$5"` +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/examples/scripts/load_url_from_bookmarks.sh b/examples/scripts/load_url_from_bookmarks.sh new file mode 100755 index 0000000..fd9179e --- /dev/null +++ b/examples/scripts/load_url_from_bookmarks.sh @@ -0,0 +1,12 @@ +#!/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/bookmarks ] +then + file=/usr/share/uzbl/examples/bookmarks +else + file=./examples/bookmarks #useful when developing +fi + +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" > $4 diff --git a/examples/scripts/load_url_from_history.sh b/examples/scripts/load_url_from_history.sh new file mode 100755 index 0000000..366aedf --- /dev/null +++ b/examples/scripts/load_url_from_history.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# you probably really want this in your $XDG_DATA_HOME (eg $HOME/.local/share/uzbl/history) +history_file=/tmp/uzbl.history + +goto=`awk '{print $3}' $history_file | sort | uniq | dmenu` +[ -n "$goto" ] && echo "uri $goto" > $4 -- cgit v1.2.3