User Tools

Site Tools


uzbl

Table of Contents

Description

A very basic implementation to run Uzbl from the CLI, opening local files.

I use it mostly for MAFF-archived pages.

Source

#!/bin/sh
# uzbl direct-launch from commandline wrapper
# requires 7-zip
# license: GPLv3

UZBL="uzbl-browser -u"
dir=$PWD
file="$1"
mypid=$$

## check args
if [ $# -ne 1 ]; then
    echo "Usage: `basename $0` <filename>"
    exit 1
fi
if [ ! -f "$file" ]; then
    echo "Cannot access file: $file"
    exit 2
fi


## for maff files
if echo "$file" | grep -E '.*\.maff' >/dev/null; then
    dir=/tmp/maff-$mypid
    7z -o${dir} x $file || exit 4

    subdir=`7z l $file | grep -oE "[0-9]*_[0-9]*$"`
    dir=$dir/$subdir
    file=index.html
fi

cd $dir
$UZBL $file

Installation

Put in a directory contaned in your shell's $PATH.

uzbl.txt · Last modified: 2016/08/31 14:10 (external edit)