A simple extension manager for Uzbl. This will open files with extension ”.uzbl”.
#!/bin/sh # Some sites block the default wget --user-agent.. GET="wget --user-agent=Firefox" url="$8" http_proxy="$9" export http_proxy test "x$url" = "x" && { echo "you must supply a url! ($url)"; exit 1; } # only changes the dir for the $get sub process if echo "$url" | grep -E '^.*\.uzbl$' >/dev/null; then ( tmp=$(mktemp); $GET "$url" -O $tmp; $XDG_DATA_HOME/uzbl/scripts/uzbl-install.sh $tmp ) fi
#!/bin/sh if [ -z $@ ] then echo "Usage: uzbl-install *.uzbl.tar.gz" exit fi for a in $@ do TMP_DIRECTORY=$(mktemp -d) #mkdir -p $TMP_DIRECTORY case $(file -b --mime-type $a) in application/x-gzip) ( tar xfz $a -C $TMP_DIRECTORY ) ;; application/ esac NAME="$(cat $TMP_DIRECTORY/name)" EXTENSION_DIRECTORY="$XDG_DATA_HOME/uzbl/extensions" CONFIG_FILE="$XDG_CONFIG_HOME/uzbl/config" mkdir -p $EXTENSION_DIRECTORY/$NAME #cat $CONFIG_FILE > /tmp/uzbl-config #cat $TMP_DIRECTORY/config | sed "s|$EXTENSION_DIRECTORY/$NAME|$TMP_DIRECTORY/scripts|g" >> /tmp/uzbl-config #cat /tmp/uzbl-config | uzbl-core -c - installed=0 if [ ! -z "$(grep "^$(cat $TMP_DIRECTORY/config | sed 's/\\/\\\\/g')$" $CONFIG_FILE)" ] then echo "Not appending to config file, extension appears to already be installed." else cat $TMP_DIRECTORY/config >> $CONFIG_FILE fi cp -r $TMP_DIRECTORY/* $EXTENSION_DIRECTORY/$NAME for f in $(ls "$EXTENSION_DIRECTORY/$NAME/scripts") do sed -n -e "s|\$XDG_DATA_HOME/uzbl/scripts|$EXTENSION_DIRECTORY/$NAME/scripts|g" "$EXTENSION_DIRECTORY/$NAME/scripts/$f" done done
Copy both scripts to $XDG_DATA_HOME/uzbl/scripts/
Add this to your config file:
@on_event DOWNLOAD_REQUEST spawn $XDG_DATA_HOME/uzbl/scripts/download-dot-uzbl.sh %s \@proxy_url
Some Uzbl extensions:
In the git repo there is a template Uzbl extension file, you can look there for more info.
Directory Structure: