You are not logged in.

#1 2010-04-17 10:31:49

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

[Uzbl] 3 [solved] questions

Hi, I'm a complete newbie when it comes to uzbl and I would really need some help to perform a couple of basic tasks.

1. Follow links in new tabs
I'm using uzbl-tabbed and the default follow.js script. I bound it to 'f' and it works perfectly.
I would like to know how do I make it work to follow links in new tab, instead that in the current one, and binding this behaviour to 'F'.
Also, middle-mouse click should open links in new tabs and not new windows: how can I change this?

2. Download manager
One of the things I miss from firefox is a download manager.
How can I add to uzbl a simple download manager that shows the progress of downloads?

3. Adblock
The other thing is an ad-blocker. I've seen that there's something on uzbl's wiki, but I really can't understand how do I insert it into uzbl and how do I make it work.

Please, try to explain me what I have to do step by step as I am probably missing something very basic on how to extend uzbl's features.

Thank you very much. smile

Last edited by rent0n (2010-04-18 21:42:08)


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#2 2010-04-17 10:49:31

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: [Uzbl] 3 [solved] questions

Offline

#3 2010-04-17 14:35:55

humanzoo
Member
Registered: 2007-10-14
Posts: 28

Re: [Uzbl] 3 [solved] questions

For question 3, I use the web caching proxy, polipo, and followed this page to set up adblocking. Then add to ~/.config/uzbl/config:

set proxy_url = http://127.0.0.1:8123

You can use most of the ever popular EasyList or Fanboy's adblock lists, though setup and updating is all manual. Still, it seems to work pretty well.

Offline

#4 2010-04-17 19:06:50

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Uzbl] 3 [solved] questions

1. Last time I looked, this was disabled (due to some javascript insecurity). Middle-clicking seems to be the next best solution at the moment.

2. Brisbin33 has a neat little script that does this.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2010-04-17 19:16:03

kaptenen
Member
Registered: 2009-12-06
Posts: 287
Website

Re: [Uzbl] 3 [solved] questions

1b)
# Middle click open in new window
@bind  <Button2>  = sh 'if [ "\@SELECTED_URI" ]; then echo "event NEW_TAB \@SELECTED_URI" > $4; fi'

Offline

#6 2010-04-17 20:03:43

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Uzbl] 3 [solved] questions

Thanks everyone for your posts, here's my progress:

1a. Ok, follow links in new tabs doesn't work, but how do I follow links in new windows? Does this work for you? I tried to use the script in thw uzbl wiki or to modify the follow.js script shipped with uzbl but I still can't make it work.

1b. kaptenen: I tried your solution but it doesn't work for me, middle-clicking does nothing. Does this work for you?

2. jasonwryan: thanks, that's nice. However I found a KISSer solution here: http://www.uzbl.org/wiki/dl-progress-statusbar , have you tried it?

3. The adblock script on uzbl wiki definitely doesn't work, I keep getting an error about the uzblAdBlock function that doesn't exist. So I adopted JohannesSM64's solution, even if I don't like too much messing with /etc/hosts...


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#7 2010-04-17 20:31:24

kaptenen
Member
Registered: 2009-12-06
Posts: 287
Website

Re: [Uzbl] 3 [solved] questions

Yes it works for me, I'm using the experimental branch, but i don't know if that's matters. Put this in your config:
@on_event   NEW_WINDOW    event NEW_TAB %s

Offline

#8 2010-04-17 20:44:36

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Uzbl] 3 [solved] questions

Still no luck, it is probably because I'm using the stable version from the repos.
Well, in the meanwhile I can use i3's tabbed layout, which is quite good.
If only I could follow links in new windows!


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#9 2010-04-17 21:53:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Uzbl] 3 [solved] questions

Works fine for me in the stable version - you can check my config for the set up. I haven't tried the newer download script: but I will - thanks rent0n.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2010-04-17 22:29:30

&#32 Greg
Member
Registered: 2009-02-08
Posts: 80

Re: [Uzbl] 3 [solved] questions

For 1: In your config file, you need the line

set javascript_windows = 1

And then you need a new follow... in this example follownew.js

/* This is the basic linkfollowing script.
 * Its pretty stable, and you configure which keys to use for hinting
 *
 * TODO: Some pages mess around a lot with the zIndex which
 * lets some hints in the background.
 * TODO: Some positions are not calculated correctly (mostly
 * because of uber-fancy-designed-webpages. Basic HTML and CSS
 * works good
 * TODO: Still some links can't be followed/unexpected things
 * happen. Blame some freaky webdesigners ;)
 */

//Just some shortcuts and globals
var uzblid = 'uzbl_link_hint';
var uzbldivid = uzblid + '_div_container';
var doc = document;
var win = window;
var links = document.links;
var forms = document.forms;
var ret="";
//Make onlick-links "clickable"
try {
    HTMLElement.prototype.click = function() {
        if (typeof this.onclick == 'function') {
            this.onclick({
                type: 'click'
            });
        }
    };
} catch(e) {}
//Catch the ESC keypress to stop linkfollowing
function keyPressHandler(e) {
    var kC = window.event ? event.keyCode: e.keyCode;
    var Esc = window.event ? 27 : e.DOM_VK_ESCAPE;
    if (kC == Esc) {
        removeAllHints();
    }
}
//Calculate element position to draw the hint
//Pretty accurate but on fails in some very fancy cases
function elementPosition(el) {
    var up = el.offsetTop;
    var left = el.offsetLeft;
    var width = el.offsetWidth;
    var height = el.offsetHeight;
    while (el.offsetParent) {
        el = el.offsetParent;
        up += el.offsetTop;
        left += el.offsetLeft;
    }
    return [up, left, width, height];
}
//Calculate if an element is visible
function isVisible(el) {
    if (el == doc) {
        return true;
    }
    if (!el) {
        return false;
    }
    if (!el.parentNode) {
        return false;
    }
    if (el.style) {
        if (el.style.display == 'none') {
            return false;
        }
        if (el.style.visibility == 'hidden') {
            return false;
        }
    }
    return isVisible(el.parentNode);
}
//Calculate if an element is on the viewport.
function elementInViewport(el) {
    offset = elementPosition(el);
    var up = offset[0];
    var left = offset[1];
    var width = offset[2];
    var height = offset[3];
    return up < window.pageYOffset + window.innerHeight && left < window.pageXOffset + window.innerWidth && (up + height) > window.pageYOffset && (left + width) > window.pageXOffset;
}
//Removes all hints/leftovers that might be generated
//by this script.
function removeAllHints() {
    var elements = doc.getElementById(uzbldivid);
    if (elements) {
        elements.parentNode.removeChild(elements);
    }
}
//Generate a hint for an element with the given label
//Here you can play around with the style of the hints!
function generateHint(el, label) {
    var pos = elementPosition(el);
    var hint = doc.createElement('div');
    hint.setAttribute('name', uzblid);
    hint.innerText = label;
    hint.style.display = 'inline';
    hint.style.backgroundColor = '#B9FF00';
    hint.style.border = '2px solid #4A6600';
    hint.style.color = 'black';
    hint.style.fontSize = '9px';
    hint.style.fontWeight = 'bold';
    hint.style.lineHeight = '9px';
    hint.style.margin = '0px';
    hint.style.width = 'auto'; // fix broken rendering on w3schools.com
    hint.style.padding = '1px';
    hint.style.position = 'absolute';
    hint.style.zIndex = '1000';
    // hint.style.textTransform = 'uppercase';
    hint.style.left = pos[1] + 'px';
    hint.style.top = pos[0] + 'px';
    // var img = el.getElementsByTagName('img');
    // if (img.length > 0) {
    //     hint.style.top = pos[1] + img[0].height / 2 - 6 + 'px';
    // }
    hint.style.textDecoration = 'none';
    // hint.style.webkitBorderRadius = '6px'; // slow
    // Play around with this, pretty funny things to do :)
    // hint.style.webkitTransform = 'scale(1) rotate(0deg) translate(-6px,-5px)';
    return hint;
}
//Here we choose what to do with an element if we
//want to "follow" it. On form elements we "select"
//or pass the focus, on links we try to perform a click,
//but at least set the href of the link. (needs some improvements)
function clickElem(item) {
    removeAllHints();
    if (item) {
        var name = item.tagName;
        if (name == 'A') {
            //item.click();
        //window.open("http://www.google.com");
        ret=item.href;
        open(ret);
        } else if (name == 'INPUT') {
            var type = item.getAttribute('type').toUpperCase();
            if (type == 'TEXT' || type == 'FILE' || type == 'PASSWORD') {
                item.focus();
                item.select();
            } else {
                item.click();
            }
        } else if (name == 'TEXTAREA' || name == 'SELECT') {
            item.focus();
            item.select();
        } else {
            //item.click();
            //window.location = item.href;
        }
    }
}
//Returns a list of all links (in this version
//just the elements itself, but in other versions, we
//add the label here.
function addLinks() {
    res = [[], []];
    for (var l = 0; l < links.length; l++) {
        var li = links[l];
        if (isVisible(li) && elementInViewport(li)) {
            res[0].push(li);
        }
    }
    return res;
}
//Same as above, just for the form elements
function addFormElems() {
    res = [[], []];
    for (var f = 0; f < forms.length; f++) {
        for (var e = 0; e < forms[f].elements.length; e++) {
            var el = forms[f].elements[e];
            if (el && ['INPUT', 'TEXTAREA', 'SELECT'].indexOf(el.tagName) + 1 && isVisible(el) && elementInViewport(el)) {
                res[0].push(el);
            }
        }
    }
    return res;
}
//Draw all hints for all elements passed. "len" is for
//the number of chars we should use to avoid collisions
function reDrawHints(elems, chars) {
    removeAllHints();
    var hintdiv = doc.createElement('div');
    hintdiv.setAttribute('id', uzbldivid);
    for (var i = 0; i < elems[0].length; i++) {
        if (elems[0][i]) {
            var label = elems[1][i].substring(chars);
            var h = generateHint(elems[0][i], label);
            hintdiv.appendChild(h);
        }
    }
    if (document.body) {
        document.body.appendChild(hintdiv);
    }
}
// pass: number of keys
// returns: key length
function labelLength(n) {
    var oldn = n;
    var keylen = 0;
    if(n < 2) {
        return 1;
    }
    n -= 1; // our highest key will be n-1
    while(n) {
        keylen += 1;
        n = Math.floor(n / charset.length);
    }
    return keylen;
}
// pass: number
// returns: label
function intToLabel(n) {
    var label = '';
    do {
        label = charset.charAt(n % charset.length) + label;
        n = Math.floor(n / charset.length);
    } while(n);
    return label;
}
// pass: label
// returns: number
function labelToInt(label) {
    var n = 0;
    var i;
    for(i = 0; i < label.length; ++i) {
        n *= charset.length;
        n += charset.indexOf(label[i]);
    }
    return n;
}
//Put it all together
function followLinks(follow) {
    // if(follow.charAt(0) == 'l') {
    //     follow = follow.substr(1);
    //     charset = 'thsnlrcgfdbmwvz-/';
    // }
    var s = follow.split('');
    var linknr = labelToInt(follow);
    if (document.body) document.body.setAttribute('onkeyup', 'keyPressHandler(event)');
    var linkelems = addLinks();
    var formelems = addFormElems();
    var elems = [linkelems[0].concat(formelems[0]), linkelems[1].concat(formelems[1])];
    var len = labelLength(elems[0].length);
    var oldDiv = doc.getElementById(uzbldivid);
    var leftover = [[], []];
    if (s.length == len && linknr < elems[0].length && linknr >= 0) {
        clickElem(elems[0][linknr]);
    } else {
        for (var j = 0; j < elems[0].length; j++) {
            var b = true;
            var label = intToLabel(j);
            var n = label.length;
            for (n; n < len; n++) {
                label = charset.charAt(0) + label;
            }
            for (var k = 0; k < s.length; k++) {
                b = b && label.charAt(k) == s[k];
            }
            if (b) {
                leftover[0].push(elems[0][j]);
                leftover[1].push(label);
            }
        }
        reDrawHints(leftover, s.length);
    }
}

//Parse input: first argument is follow keys, second is user input.
var args = '%s'.split(' ');
var charset = args[0];
followLinks(args[1]);

And then you get the bind line in your config...

@cbind F* = script @scripts_dir/follownew.js '@follow_hint_keys %s'

Oh, and you also need @on_event NEW_WINDOW to be on the event NEW_TAB %s option for this to open in a new tab, otherwise it opens in a new window.

Last edited by &#32 Greg (2010-04-17 22:31:45)

Offline

#11 2010-04-17 22:39:32

alterecco
Member
Registered: 2009-07-13
Posts: 152

Re: [Uzbl] 3 [solved] questions

With regards to opening links on click, I ran into the same problem. I want to Control click links to open in new window, but I could not make this work with <Ctrl><Button1> or similar.

I hacked up a little script that does work though, although I consider it a bit ugly

@on_event   LOAD_COMMIT         js window.addEventListener("click",function(e){if(e.srcElement.href){if(e.button==0 && e.ctrlKey){e.stopPropagation();e.preventDefault();window.open(e.srcElement.href);return;}}});

With minor changes you should be able to adapt this to your needs. Notice you need the

set javascript_windows = 1

from &#32 Greg's post above as well (you need that for any script that calls `window.open'

Last edited by alterecco (2010-04-17 23:06:11)

Offline

#12 2010-04-18 12:07:48

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Uzbl] 3 [solved] questions

I'm very surprised but I finally got opening links in new tabs working, both with mouse middle click and with the follow link script.
Everything now is so confortable! big_smile Thanks everyone and especially to &#32 Greg, kaptenen and jasonwryan.

I will post here my configs and scripts, for reference:

~/.config/uzbl/config

# example uzbl config.
# all settings are optional.  you can use uzbl without any config at all (but it won't do much)

set prefix     = /usr

# === Shortcuts / Aliases  ===================================================

# Config related events (use the request function):
# request BIND <bind cmd> = <command>
set bind            = request BIND
# request MODE_BIND <mode> <bind cmd> = <command>
set mode_bind       = request MODE_BIND
# request MODE_CONFIG <mode> <key> = <value>
set mode_config     = request MODE_CONFIG
# request ON_EVENT <EVENT_NAME> <command>
set on_event        = request ON_EVENT
# request PROGRESS_CONFIG <key> = <value>
set progress        = request PROGRESS_CONFIG
# request MODMAP <From> <To>
set modmap          = request MODMAP
# request IGNORE_KEY <glob>
set ignore_key      = request IGNORE_KEY
# request MODKEY_ADDITION <key1> <key2> <keyn> <result>
set modkey_addition = request MODKEY_ADDITION

# Action related events (use the event function):
# event TOGGLE_MODES <mode1> <mode2> ... <moden>
set toggle_modes    = event TOGGLE_MODES

set set_mode        = set mode =
set set_status      = set status_message =
set shell_cmd       = sh -c

# Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable"
#set scripts_dir     = $XDG_DATA_HOME/uzbl:@prefix/share/uzbl/examples/data:scripts
set scripts_dir        = $XDG_CONFIG_HOME/uzbl/scripts

# === Handlers ===============================================================

# --- Hardcoded event handlers -----------------------------------------------

# These handlers can't be moved to the new event system yet as we don't
# support events that can wait for a response from a script.
set cookie_handler      = talk_to_socket $XDG_CACHE_HOME/uzbl/cookie_daemon_socket
set scheme_handler      = sync_spawn @scripts_dir/scheme.py
set authentication_handler = sync_spawn @scripts_dir/auth.py

# Open in the same window.
#set new_window         = sh 'echo uri "$8" > $4'
# Open a link in a new window. equivalent to default behavior
set new_window          = sh 'uzbl-browser -u $8'
# Required for opening links in new tabs
set javascript_windows  = 1

# --- Optional dynamic event handlers ----------------------------------------

# Download handler
@on_event   DOWNLOAD_REQUEST    spawn @scripts_dir/download.sh %s \@proxy_url

# Load start handler
@on_event   LOAD_START     @set_status <span foreground="#395573">wait</span>
# Reset the keycmd on navigation
@on_event   LOAD_START     @set_mode

# Load commit handlers
@on_event   LOAD_COMMIT    @set_status <span foreground="#395573">recv</span>
#@on_event   LOAD_COMMIT    script @scripts_dir/scroll-percentage.js

# Load finish handlers
@on_event   LOAD_FINISH    @set_status <span foreground="#395573">done</span>
@on_event   LOAD_FINISH    spawn @scripts_dir/history.sh

# Switch to insert mode if a (editable) html form is clicked
@on_event   FORM_ACTIVE    @set_mode insert
# Switch to command mode if anything else is clicked
@on_event   ROOT_ACTIVE    @set_mode command

# Example CONFIG_CHANGED event handler
#@on_event  CONFIG_CHANGED print Config changed: %1 = %2

# Required for opening links in new tabs
@on_event   NEW_WINDOW   event NEW_TAB %s 

# === Behaviour and appearance ===============================================

set show_status       = 1
set status_top        = 0
set status_background = #000000

set modcmd_style      = weight="bold" foreground="#8C4665"
set keycmd_style      = weight="light" foreground="#8C4665"
set prompt_style      = foreground="#999999"
set cursor_style      = underline="single"
set completion_style  = foreground="#287373"
set hint_style        = weight="bold"

set mode_section      = <span background="#899CA1" foreground="#000000">[\@[\@mode_indicator]\@]</span>
set keycmd_section    = [<span \@prompt_style>\@[\@keycmd_prompt]\@</span><span \@modcmd_style>\@modcmd</span><span \@keycmd_style>\@keycmd</span><span \@completion_style>\@completion_list</span>]
set progress_section  = <span foreground="#333333">\@[\@progress_format]\@</span>
set scroll_section    = <span foreground="#333333">\@[\@scroll_message]\@</span>
set uri_section       = <span foreground="#287373">\@[\@uri]\@</span>
set name_section      = <span foreground="#5E468C">\@[\@NAME]\@</span>
set status_section    = <span foreground="#395573">\@status_message</span>
set selected_section  = <span foreground="#899CA1">\@[\@SELECTED_URI]\@</span>
set dl_status         = <span foreground="#8C4665">\@dl_stat</span>

set status_format     = <span font_family="terminus">@mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @scroll_section @selected_section @dl_status</span>

set title_format_long = \@keycmd_prompt \@raw_modcmd \@raw_keycmd \@TITLE - Uzbl browser <\@NAME> \@SELECTED_URI

# Progress bar config
@progress width    = 8
# %d = done, %p = pending %c = percent done, %i = int done, %s = spinner,
# %t = percent pending, %o = int pending, %r = sprite scroll
@progress format   = [%d>%p]%c
@progress done     = =
@progress pending  =

# Or ride those spinnas'
#@progress format   = [%d%s%p]
#@progress spinner  = -\\|/
#@progress done     = -
#@progress pending  =


# == Tabs settings ==========================================================

set tab_titles                = 1
set new_tab_title            = Loading
set max_title_len            = 30
set show_ellipsis            = 1
set capture_new_windows        = 1
set tab_colours                = foreground = "#999999" background = "#000000"
set tab_text_colours        = foreground = "#999999"
set selected_tab            = foreground = "#287373"
set selected_tab_text        = foreground = "#287373"
set tab_indicate_https        = 1
set https_colours            = foreground = "#888"
set https_text_colours        = foreground = "#9c8e2d"
set selected_https            = foreground = "#fff"
set selected_https_text        = foreground = "gold"


# === Core settings ==========================================================

set useragent         = Uzbl (Webkit @WEBKIT_MAJOR.@WEBKIT_MINOR.@WEBKIT_MICRO) (@(+uname -o)@ @(+uname -m)@ [@ARCH_UZBL]) (Commit @COMMIT)
set fifo_dir          = /tmp
set socket_dir        = /tmp


# === Key modmapping and ignoring ============================================

#modmap <From>          <To>
@modmap <Control>       <Ctrl>
@modmap <ISO_Left_Tab>  <Shift-Tab>
@modmap <space>         <Space>

#modkey_addition <Key1>  <Key2>    <Result>
@modkey_addition <Shift> <Ctrl>    <Meta>
@modkey_addition <Shift> <Tab>     <Shift-Tab>

#ignore_key <glob>
@ignore_key <ISO_*>
@ignore_key <Shift>


# === Mode bind aliases ======================================================

# Global binding alias (this is done automatically inside the bind plugin).
#set bind = @mode_bind global

# Insert mode binding alias
set ibind = @mode_bind insert

# Command mode binding alias
set cbind = @mode_bind command

# Non-insert mode bindings alias (ebind for edit-bind).
set ebind = @mode_bind global,-insert


# === Global & keycmd editing binds ==========================================

# Resets keycmd and returns to default mode.
@bind   <Escape>     = @set_mode

# Commands for editing and traversing the keycmd.
@ebind  <Return>     = event KEYCMD_EXEC_CURRENT
@ebind  <Home>       = event SET_CURSOR_POS
@ebind  <End>        = event SET_CURSOR_POS -1
@ebind  <Left>       = event SET_CURSOR_POS -
@ebind  <Right>      = event SET_CURSOR_POS +
@ebind  <BackSpace>  = event KEYCMD_BACKSPACE
@ebind  <Delete>     = event KEYCMD_DELETE
@ebind  <Tab>        = event START_COMPLETION
# Readline-ish bindings.
@ebind  <Ctrl>w      = event KEYCMD_STRIP_WORD
@ebind  <Ctrl>u      = event SET_KEYCMD
@ebind  <Ctrl>a      = event SET_CURSOR_POS 0
@ebind  <Ctrl>e      = event SET_CURSOR_POS -1

# Keycmd injection/append examples.
#@ebind  <Ctrl>su = event INJECT_KEYCMD \@uri
#@ebind  <Ctrl>st = event INJECT_KEYCMD \@title
#@ebind  <Ctrl>du = event APPEND_KEYCMD \@uri
#@ebind  <Ctrl>dt = event APPEND_KEYCMD \@title


# === Mouse bindings =========================================================

# Middle click open in new window
#@bind  <Button2>  = sh 'if [ "\@SELECTED_URI" ]; then uzbl-browser -u "\@SELECTED_URI"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > $4; fi'
# Middle click open in new tab
@cbind  <Button2> = sh 'if [ "\@SELECTED_URI" ]; then echo "event NEW_TAB \@SELECTED_URI" > $4; fi'

# === Keyboard bindings ======================================================

# With this command you can enter in any command at runtime when prefixed with
# a colon.
@cbind    :_        = %s

# --- Page movement binds ---
@cbind  j            = scroll vertical 20
@cbind  k            = scroll vertical -20
@cbind  h            = scroll horizontal -20
@cbind  l            = scroll horizontal 20
@cbind  <Up>         = scroll vertical -20
@cbind  <Down>       = scroll vertical 20
@cbind  <Left>       = scroll horizontal -20
@cbind  <Right>      = scroll horizontal 20
@cbind  <Page_Up>    = scroll vertical -90%
@cbind  <Page_Down>  = scroll vertical 90%
@cbind  <<           = scroll vertical begin
@cbind  >>           = scroll vertical end
@cbind  ^            = scroll horizontal begin
@cbind  $            = scroll horizontal end
@cbind  <Home>       = scroll vertical begin
@cbind  <End>        = scroll vertical end
@cbind  <Space>      = scroll vertical 90%
#@cbind  <Ctrl>f      = scroll vertical 90%
#@cbind  <Ctrl>b      = scroll vertical -90%

# --- Navigation binds ---
@cbind  b   = back
@cbind  m   = forward
@cbind  S   = stop
@cbind  r   = reload
@cbind  R   = reload_ign_cache

# --- Zoom binds ---
@cbind  +   = zoom_in
@cbind  -   = zoom_out
@cbind  T   = toggle_zoom_type
@cbind  1   = set zoom_level = 1.0
@cbind  2   = set zoom_level = 2.0

# --- Appearance binds ---
@cbind  t   = toggle_status

# --- Page searching binds ---
@cbind  /*  = search %s
@cbind  ?*  = search_reverse %s
# Jump to next and previous items
@cbind  n   = search
@cbind  N   = search_reverse

# --- Uzbl tabbed binds ---
# Tab opening
@cbind  gn              = event NEW_TAB
@cbind  gN              = event NEW_TAB_NEXT
@cbind  go<uri:>_       = event NEW_TAB %s
@cbind  gO<uri:>_       = event NEW_TAB_NEXT %s
@cbind  gY              = sh 'echo "event NEW_TAB `xclip -selection primary -o | sed s/\\\@/%40/g`" > $4'
# Closing / resting
@cbind  gC              = exit
@cbind  gQ              = event CLEAN_TABS
# Tab navigating
@cbind  g<              = event FIRST_TAB
@cbind  g>              = event LAST_TAB
@cbind  gt              = event NEXT_TAB
@cbind  gT              = event PREV_TAB
@cbind  gi<index:>_     = event GOTO_TAB %s
# Preset loading
set preset = event PRESET_TABS
@cbind  gs<preset save:>_   = @preset save %s
@cbind  glo<preset load:>_  = @preset load %s
@cbind  gd<preset del:>_    = @preset del %s
@cbind  gli                 = @preset list

# --- Web searching binds ---
@cbind  sg<Google:>_         = uri http://www.google.com/search?q=\@<encodeURIComponent(%r)>\@
@cbind  saw<ArchWiki:>_  = uri http://wiki.archlinux.org/index.php/Special:Search?search=\@<encodeURIComponent(%r)>\@&go=Go
@cbind  sw<Wikipedia:>_  = uri http://en.wikipedia.org/w/index.php?title=Special:Search&search=\@<encodeURIComponent(%r)>\@&go=Go

# --- Handy binds ---
# Set function shortcut
@cbind  v<var:>_<value:>_  = set %1 = %2
# Exit binding
@cbind  ZZ                 = exit
# Dump config to stdout
@cbind  !dump              = sh "echo dump_config > $4"
# Reload config
@cbind  !reload            = sh "sed '/^# === Post-load misc commands/,$d' $1 > $4"
# Use socat to directly inject commands into uzbl-core and view events
# raised by uzbl-core:
@cbind  <Ctrl><Alt>t  = sh 'xterm -e "socat unix-connect:$5 -"'
#@cbind  <Ctrl><Alt>t  = sh 'urxvt -e socat unix-connect:$5 -'

# --- Uri opening prompts ---
@cbind  o<uri:>_       = uri %s
# Or have it load the current uri into the keycmd for editing
@cbind  O<uri:\@uri>_  = uri %s

# --- Mode setting binds ---
# Changing mode via  set.
@cbind  I  = @set_mode insert
# Or toggle between modes by raising the toggle event.
set toggle_cmd_ins = @toggle_modes command insert
@cbind  i          = @toggle_cmd_ins
# And the global toggle bind.
@bind   <Ctrl>i    = @toggle_cmd_ins

# --- Hard-bound bookmarks ---
@cbind  gh  = uri http://www.google.com

# --- Yanking & pasting binds ---
@cbind  yu  = sh 'echo -n $6 | xclip'
@cbind  yy  = sh 'echo -n $7 | xclip'

# Go the page from primary selection
@cbind  p   = sh 'echo "uri `xclip -selection primary -o | sed s/\\\@/%40/g`" > $4'
# Go to the page in clipboard
@cbind  P   = sh 'echo "uri `xclip -selection clipboard -o | sed s/\\\@/%40/g`" > $4'
# Start a new uzbl instance from the page in primary selection
@cbind  'p  = sh 'exec uzbl-browser --uri $(xclip -o)'

# --- Bookmark inserting binds ---
@cbind <Ctrl>b<tags:>_  = sh 'echo -e "$6 %s" >> $XDG_DATA_HOME/uzbl/bookmarks'
# Or use a script to insert a bookmark.
@cbind  B  = spawn @scripts_dir/insert_bookmark.sh

# --- Bookmark/history loading ---
@cbind  U  = spawn @scripts_dir/load_url_from_history.sh
@cbind  u  = spawn @scripts_dir/load_url_from_bookmarks.sh

# --- Link following (similar to vimperator and konqueror) ---
# Set custom keys you wish to use for navigation. Some common examples:
#set follow_hint_keys = 0123456789
#set follow_hint_keys = qwerty
#set follow_hint_keys = asdfghjkl;
#set follow_hint_keys = thsnd-rcgmvwb/;789aefijkopquxyz234
set follow_hint_keys = mjkluio789
@cbind  f*  = script @scripts_dir/follow.js '@follow_hint_keys %s'
@cbind F* = script @scripts_dir/follow_new_tab.js '@follow_hint_keys %s'

# --- Form filler binds ---
# this script allows you to configure (per domain) values to fill in form
# fields (eg login information) and to fill in these values automatically
set formfiller = spawn @scripts_dir/formfiller
@cbind  za  = @{formfiller}.sh
@cbind  ze  = @{formfiller}.sh edit
@cbind  zn  = @{formfiller}.sh new
@cbind  zl  = @{formfiller}.sh load
# Or the more advanced implementation using perl: (could not get this to run - Dieter)
@cbind  LL  = @{formfiller}.pl load
@cbind  LN  = @{formfiller}.pl new
@cbind  LE  = @{formfiller}.pl edit

# --- External edit script configuration & binds ---
# Edit form input fields in an external editor (gvim, emacs, urxvt -e vim, ..)
# disabled since Uzbl object is gone
set external_editor = gvim
#set external_editor = xterm -e vim
#@cbind  E  = script @scripts_dir/extedit.js
# And add menu option.
#menu_editable_add Open in @external_editor = script @scripts_dir/extedit.js

# --- Examples ---
# Example showing how to use uzbl's fifo to execute a command.
#@bind  X1 = sh 'echo "set zoom_level = 1.0" > "$4"'
#@bind  X2 = sh 'echo "js alert (\\"This is sent by the shell via a fifo\\")" > "$4"'


# === Context menu items =====================================================

# Default context menu
menu_add Google = set uri = http://google.com
menu_add Go Home = set uri = http://uzbl.org
menu_separator separator_1
menu_add Quit uzbl = exit

# Link context menu
menu_link_add Print Link = print \@SELECTED_URI


# === Mode configuration =====================================================

# Define some mode specific uzbl configurations.
set command  = @mode_config command
set insert   = @mode_config insert
set stack    = @mode_config stack

# Command mode config.
@command  keycmd_style        = foreground="#8C4665"
@command  status_background   = #000000
@command  mode_indicator      = Cmd

# Insert mode config.
@insert   status_background   = #000000
@insert   mode_indicator      = Ins

# Multi-stage-binding mode config.
@stack    keycmd_events       = 1
@stack    modcmd_updates      = 1
@stack    forward_keys        = 0
@stack    keycmd_style        = foreground="#8C4665"
@stack    prompt_style        = foreground="#888" weight="light"
@stack    status_background   = #000000
@stack    mode_indicator      = Bnd

set default_mode = command


# === Post-load misc commands  ===============================================

# Set the "home" page.
set uri = http://www.google.com 


# === Fonts ==================================================================

# Font size
set font_size =  10
set minimum_font_size = 5

~/.config/uzbl/scripts/follow.js

/* This is the basic linkfollowing script.
 * Its pretty stable, and you configure which keys to use for hinting
 *
 * TODO: Some pages mess around a lot with the zIndex which
 * lets some hints in the background.
 * TODO: Some positions are not calculated correctly (mostly
 * because of uber-fancy-designed-webpages. Basic HTML and CSS
 * works good
 * TODO: Still some links can't be followed/unexpected things
 * happen. Blame some freaky webdesigners ;)
 */

//Just some shortcuts and globals
var uzblid = 'uzbl_link_hint';
var uzbldivid = uzblid + '_div_container';
var doc = document;
var win = window;
var links = document.links;
var forms = document.forms;
//Make onlick-links "clickable"
try {
    HTMLElement.prototype.click = function() {
        if (typeof this.onclick == 'function') {
            this.onclick({
                type: 'click'
            });
        }
    };
} catch(e) {}
//Catch the ESC keypress to stop linkfollowing
function keyPressHandler(e) {
    var kC = window.event ? event.keyCode: e.keyCode;
    var Esc = window.event ? 27 : e.DOM_VK_ESCAPE;
    if (kC == Esc) {
        removeAllHints();
    }
}
//Calculate element position to draw the hint
//Pretty accurate but on fails in some very fancy cases
function elementPosition(el) {
    var up = el.offsetTop;
    var left = el.offsetLeft;
    var width = el.offsetWidth;
    var height = el.offsetHeight;
    while (el.offsetParent) {
        el = el.offsetParent;
        up += el.offsetTop;
        left += el.offsetLeft;
    }
    return [up, left, width, height];
}
//Calculate if an element is visible
function isVisible(el) {
    if (el == doc) {
        return true;
    }
    if (!el) {
        return false;
    }
    if (!el.parentNode) {
        return false;
    }
    if (el.style) {
        if (el.style.display == 'none') {
            return false;
        }
        if (el.style.visibility == 'hidden') {
            return false;
        }
    }
    return isVisible(el.parentNode);
}
//Calculate if an element is on the viewport.
function elementInViewport(el) {
    offset = elementPosition(el);
    var up = offset[0];
    var left = offset[1];
    var width = offset[2];
    var height = offset[3];
    return up < window.pageYOffset + window.innerHeight && left < window.pageXOffset + window.innerWidth && (up + height) > window.pageYOffset && (left + width) > window.pageXOffset;
}
//Removes all hints/leftovers that might be generated
//by this script.
function removeAllHints() {
    var elements = doc.getElementById(uzbldivid);
    if (elements) {
        elements.parentNode.removeChild(elements);
    }
}
//Generate a hint for an element with the given label
//Here you can play around with the style of the hints!
function generateHint(el, label) {
    var pos = elementPosition(el);
    var hint = doc.createElement('div');
    hint.setAttribute('name', uzblid);
    hint.innerText = label;
    hint.style.display = 'inline';
    hint.style.backgroundColor = '#999999';
    hint.style.border = '0px solid #333333';
    hint.style.color = '#000000';
    hint.style.fontSize = '11px';
    hint.style.fontWeight = 'bold';
    hint.style.lineHeight = '12px';
    hint.style.margin = '0px';
    hint.style.width = 'auto'; // fix broken rendering on w3schools.com
    hint.style.padding = '1px';
    hint.style.position = 'absolute';
    hint.style.zIndex = '1000';
    hint.style.textTransform = 'uppercase';
    hint.style.left = pos[1] + 'px';
    hint.style.top = pos[0] + 'px';
    // var img = el.getElementsByTagName('img');
    // if (img.length > 0) {
    //     hint.style.top = pos[1] + img[0].height / 2 - 6 + 'px';
    // }
    hint.style.textDecoration = 'none';
    // hint.style.webkitBorderRadius = '6px'; // slow
    // Play around with this, pretty funny things to do :)
    // hint.style.webkitTransform = 'scale(1) rotate(0deg) translate(-6px,-5px)';
    return hint;
}
//Here we choose what to do with an element if we
//want to "follow" it. On form elements we "select"
//or pass the focus, on links we try to perform a click,
//but at least set the href of the link. (needs some improvements)
function clickElem(item) {
    removeAllHints();
    if (item) {
        var name = item.tagName;
        if (name == 'A') {
            item.click();
            window.location = item.href;
        } else if (name == 'INPUT') {
            var type = item.getAttribute('type').toUpperCase();
            if (type == 'TEXT' || type == 'FILE' || type == 'PASSWORD') {
                item.focus();
                item.select();
            } else {
                item.click();
            }
        } else if (name == 'TEXTAREA' || name == 'SELECT') {
            item.focus();
            item.select();
        } else {
            item.click();
            window.location = item.href;
        }
    }
}
//Returns a list of all links (in this version
//just the elements itself, but in other versions, we
//add the label here.
function addLinks() {
    res = [[], []];
    for (var l = 0; l < links.length; l++) {
        var li = links[l];
        if (isVisible(li) && elementInViewport(li)) {
            res[0].push(li);
        }
    }
    return res;
}
//Same as above, just for the form elements
function addFormElems() {
    res = [[], []];
    for (var f = 0; f < forms.length; f++) {
        for (var e = 0; e < forms[f].elements.length; e++) {
            var el = forms[f].elements[e];
            if (el && ['INPUT', 'TEXTAREA', 'SELECT'].indexOf(el.tagName) + 1 && isVisible(el) && elementInViewport(el)) {
                res[0].push(el);
            }
        }
    }
    return res;
}
//Draw all hints for all elements passed. "len" is for
//the number of chars we should use to avoid collisions
function reDrawHints(elems, chars) {
    removeAllHints();
    var hintdiv = doc.createElement('div');
    hintdiv.setAttribute('id', uzbldivid);
    for (var i = 0; i < elems[0].length; i++) {
        if (elems[0][i]) {
            var label = elems[1][i].substring(chars);
            var h = generateHint(elems[0][i], label);
            hintdiv.appendChild(h);
        }
    }
    if (document.body) {
        document.body.appendChild(hintdiv);
    }
}
// pass: number of keys
// returns: key length
function labelLength(n) {
    var oldn = n;
    var keylen = 0;
    if(n < 2) {
        return 1;
    }
    n -= 1; // our highest key will be n-1
    while(n) {
        keylen += 1;
        n = Math.floor(n / charset.length);
    }
    return keylen;
}
// pass: number
// returns: label
function intToLabel(n) {
    var label = '';
    do {
        label = charset.charAt(n % charset.length) + label;
        n = Math.floor(n / charset.length);
    } while(n);
    return label;
}
// pass: label
// returns: number
function labelToInt(label) {
    var n = 0;
    var i;
    for(i = 0; i < label.length; ++i) {
        n *= charset.length;
        n += charset.indexOf(label[i]);
    }
    return n;
}
//Put it all together
function followLinks(follow) {
    // if(follow.charAt(0) == 'l') {
    //     follow = follow.substr(1);
    //     charset = 'thsnlrcgfdbmwvz-/';
    // }
    var s = follow.split('');
    var linknr = labelToInt(follow);
    if (document.body) document.body.setAttribute('onkeyup', 'keyPressHandler(event)');
    var linkelems = addLinks();
    var formelems = addFormElems();
    var elems = [linkelems[0].concat(formelems[0]), linkelems[1].concat(formelems[1])];
    var len = labelLength(elems[0].length);
    var oldDiv = doc.getElementById(uzbldivid);
    var leftover = [[], []];
    if (s.length == len && linknr < elems[0].length && linknr >= 0) {
        clickElem(elems[0][linknr]);
    } else {
        for (var j = 0; j < elems[0].length; j++) {
            var b = true;
            var label = intToLabel(j);
            var n = label.length;
            for (n; n < len; n++) {
                label = charset.charAt(0) + label;
            }
            for (var k = 0; k < s.length; k++) {
                b = b && label.charAt(k) == s[k];
            }
            if (b) {
                leftover[0].push(elems[0][j]);
                leftover[1].push(label);
            }
        }
        reDrawHints(leftover, s.length);
    }
}

//Parse input: first argument is follow keys, second is user input.
var args = '%s'.split(' ');
var charset = args[0];
followLinks(args[1]);

~/.config/uzbl/scripts/follow_new_tab.js

/* This is the basic linkfollowing script.
 * Its pretty stable, and you configure which keys to use for hinting
 *
 * TODO: Some pages mess around a lot with the zIndex which
 * lets some hints in the background.
 * TODO: Some positions are not calculated correctly (mostly
 * because of uber-fancy-designed-webpages. Basic HTML and CSS
 * works good
 * TODO: Still some links can't be followed/unexpected things
 * happen. Blame some freaky webdesigners ;)
 */

//Just some shortcuts and globals
var uzblid = 'uzbl_link_hint';
var uzbldivid = uzblid + '_div_container';
var doc = document;
var win = window;
var links = document.links;
var forms = document.forms;
var ret="";
//Make onlick-links "clickable"
try {
    HTMLElement.prototype.click = function() {
        if (typeof this.onclick == 'function') {
            this.onclick({
                type: 'click'
            });
        }
    };
} catch(e) {}
//Catch the ESC keypress to stop linkfollowing
function keyPressHandler(e) {
    var kC = window.event ? event.keyCode: e.keyCode;
    var Esc = window.event ? 27 : e.DOM_VK_ESCAPE;
    if (kC == Esc) {
        removeAllHints();
    }
}
//Calculate element position to draw the hint
//Pretty accurate but on fails in some very fancy cases
function elementPosition(el) {
    var up = el.offsetTop;
    var left = el.offsetLeft;
    var width = el.offsetWidth;
    var height = el.offsetHeight;
    while (el.offsetParent) {
        el = el.offsetParent;
        up += el.offsetTop;
        left += el.offsetLeft;
    }
    return [up, left, width, height];
}
//Calculate if an element is visible
function isVisible(el) {
    if (el == doc) {
        return true;
    }
    if (!el) {
        return false;
    }
    if (!el.parentNode) {
        return false;
    }
    if (el.style) {
        if (el.style.display == 'none') {
            return false;
        }
        if (el.style.visibility == 'hidden') {
            return false;
        }
    }
    return isVisible(el.parentNode);
}
//Calculate if an element is on the viewport.
function elementInViewport(el) {
    offset = elementPosition(el);
    var up = offset[0];
    var left = offset[1];
    var width = offset[2];
    var height = offset[3];
    return up < window.pageYOffset + window.innerHeight && left < window.pageXOffset + window.innerWidth && (up + height) > window.pageYOffset && (left + width) > window.pageXOffset;
}
//Removes all hints/leftovers that might be generated
//by this script.
function removeAllHints() {
    var elements = doc.getElementById(uzbldivid);
    if (elements) {
        elements.parentNode.removeChild(elements);
    }
}
//Generate a hint for an element with the given label
//Here you can play around with the style of the hints!
function generateHint(el, label) {
    var pos = elementPosition(el);
    var hint = doc.createElement('div');
    hint.setAttribute('name', uzblid);
    hint.innerText = label;
    hint.style.display = 'inline';
    hint.style.backgroundColor = '#999999';
    hint.style.border = '0px solid #333333';
    hint.style.color = '#000000';
    hint.style.fontSize = '11px';
    hint.style.fontWeight = 'bold';
    hint.style.lineHeight = '12px';
    hint.style.margin = '0px';
    hint.style.width = 'auto'; // fix broken rendering on w3schools.com
    hint.style.padding = '1px';
    hint.style.position = 'absolute';
    hint.style.zIndex = '1000';
    hint.style.textTransform = 'uppercase';
    hint.style.left = pos[1] + 'px';
    hint.style.top = pos[0] + 'px';
    // var img = el.getElementsByTagName('img');
    // if (img.length > 0) {
    //     hint.style.top = pos[1] + img[0].height / 2 - 6 + 'px';
    // }
    hint.style.textDecoration = 'none';
    // hint.style.webkitBorderRadius = '6px'; // slow
    // Play around with this, pretty funny things to do :)
    // hint.style.webkitTransform = 'scale(1) rotate(0deg) translate(-6px,-5px)';
    return hint;
}
//Here we choose what to do with an element if we
//want to "follow" it. On form elements we "select"
//or pass the focus, on links we try to perform a click,
//but at least set the href of the link. (needs some improvements)
function clickElem(item) {
    removeAllHints();
    if (item) {
        var name = item.tagName;
        if (name == 'A') {
            //item.click();
        //window.open("http://www.google.com");
        ret=item.href;
        open(ret);
        } else if (name == 'INPUT') {
            var type = item.getAttribute('type').toUpperCase();
            if (type == 'TEXT' || type == 'FILE' || type == 'PASSWORD') {
                item.focus();
                item.select();
            } else {
                item.click();
            }
        } else if (name == 'TEXTAREA' || name == 'SELECT') {
            item.focus();
            item.select();
        } else {
            //item.click();
            //window.location = item.href;
        }
    }
}
//Returns a list of all links (in this version
//just the elements itself, but in other versions, we
//add the label here.
function addLinks() {
    res = [[], []];
    for (var l = 0; l < links.length; l++) {
        var li = links[l];
        if (isVisible(li) && elementInViewport(li)) {
            res[0].push(li);
        }
    }
    return res;
}
//Same as above, just for the form elements
function addFormElems() {
    res = [[], []];
    for (var f = 0; f < forms.length; f++) {
        for (var e = 0; e < forms[f].elements.length; e++) {
            var el = forms[f].elements[e];
            if (el && ['INPUT', 'TEXTAREA', 'SELECT'].indexOf(el.tagName) + 1 && isVisible(el) && elementInViewport(el)) {
                res[0].push(el);
            }
        }
    }
    return res;
}
//Draw all hints for all elements passed. "len" is for
//the number of chars we should use to avoid collisions
function reDrawHints(elems, chars) {
    removeAllHints();
    var hintdiv = doc.createElement('div');
    hintdiv.setAttribute('id', uzbldivid);
    for (var i = 0; i < elems[0].length; i++) {
        if (elems[0][i]) {
            var label = elems[1][i].substring(chars);
            var h = generateHint(elems[0][i], label);
            hintdiv.appendChild(h);
        }
    }
    if (document.body) {
        document.body.appendChild(hintdiv);
    }
}
// pass: number of keys
// returns: key length
function labelLength(n) {
    var oldn = n;
    var keylen = 0;
    if(n < 2) {
        return 1;
    }
    n -= 1; // our highest key will be n-1
    while(n) {
        keylen += 1;
        n = Math.floor(n / charset.length);
    }
    return keylen;
}
// pass: number
// returns: label
function intToLabel(n) {
    var label = '';
    do {
        label = charset.charAt(n % charset.length) + label;
        n = Math.floor(n / charset.length);
    } while(n);
    return label;
}
// pass: label
// returns: number
function labelToInt(label) {
    var n = 0;
    var i;
    for(i = 0; i < label.length; ++i) {
        n *= charset.length;
        n += charset.indexOf(label[i]);
    }
    return n;
}
//Put it all together
function followLinks(follow) {
    // if(follow.charAt(0) == 'l') {
    //     follow = follow.substr(1);
    //     charset = 'thsnlrcgfdbmwvz-/';
    // }
    var s = follow.split('');
    var linknr = labelToInt(follow);
    if (document.body) document.body.setAttribute('onkeyup', 'keyPressHandler(event)');
    var linkelems = addLinks();
    var formelems = addFormElems();
    var elems = [linkelems[0].concat(formelems[0]), linkelems[1].concat(formelems[1])];
    var len = labelLength(elems[0].length);
    var oldDiv = doc.getElementById(uzbldivid);
    var leftover = [[], []];
    if (s.length == len && linknr < elems[0].length && linknr >= 0) {
        clickElem(elems[0][linknr]);
    } else {
        for (var j = 0; j < elems[0].length; j++) {
            var b = true;
            var label = intToLabel(j);
            var n = label.length;
            for (n; n < len; n++) {
                label = charset.charAt(0) + label;
            }
            for (var k = 0; k < s.length; k++) {
                b = b && label.charAt(k) == s[k];
            }
            if (b) {
                leftover[0].push(elems[0][j]);
                leftover[1].push(label);
            }
        }
        reDrawHints(leftover, s.length);
    }
}

//Parse input: first argument is follow keys, second is user input.
var args = '%s'.split(' ');
var charset = args[0];
followLinks(args[1]);

~/.config/uzbl/scripts/download.sh

#!/bin/bash
#
# the original dget.sh script:
# (c) 2007 by Robert Manea
#
# based on dl-progress by pbrisbin
# bashed again by rich_o
 
# the place to download to
DIR="$HOME"
 
# refresh rate on the progress bar
SECS=1
 
# these are passed in from uzbl
URL="$8"
 
# it needs to be specific to this DL instance
STAT="/tmp/dl_progress.$$"
 
# get filename from the url and convert some hex codes
# i hate spaces in filenames so i'm switching them
# with underscores here, adjust the first s///g if
# you want to keep the spaces
FILE="$(basename $URL | sed -r \
's/[_%]20/\_/g;s/[_%]22/\"/g;s/[_%]23/\#/g;s/[_%]24/\$/g;
s/[_%]25/\%/g;s/[_%]26/\&/g;s/[_%]28/\(/g;s/[_%]29/\)/g;
s/[_%]2C/\,/g;s/[_%]2D/\-/g;s/[_%]2E/\./g;s/[_%]2F/\//g;
s/[_%]3C/\</g;s/[_%]3D/\=/g;s/[_%]3E/\>/g;s/[_%]3F/\?/g;
s/[_%]40/\@/g;s/[_%]5B/\[/g;s/[_%]5C/\\/g;s/[_%]5D/\]/g;
s/[_%]5E/\^/g;s/[_%]5F/\_/g;s/[_%]60/\`/g;s/[_%]7B/\{/g;
s/[_%]7C/\|/g;s/[_%]7D/\}/g;s/[_%]7E/\~/g;s/[_%]2B/\+/g')"
 
# download
wget -O "$DIR/$FILE" --user-agent=Firefox "$URL" > $STAT 2>&1 &
pid=$!
 
# show progress in status bar
while ps -A | grep -q $pid; do
    COUNTER="$(ls -1 /tmp/dl_progress.* | wc -l)"
    if [ "$COUNTER" -gt "1" ];then
        declare -a perc
        for i in `ls -1 /tmp/dl_progress.*`;do
            x="$(tail -n2 $i | head -n1 | egrep -o '[0-9]{1,2}%' | sed -e 's/%//g')"
            perc[${#perc[*]}]=$x
        done
 
        # get smallest number in array
        # ugly but working
        for ((i=1; i<${#perc[*]};i++));do
            z=`expr $i - 1`
            if [ "${perc[$i]}" -lt "${perc[$z]}" ];then
                x=${perc[$i]}
            fi
        done
        REM=$x
 
    else
        REM="$(tail -n2 $STAT | head -n1 | egrep -o '[0-9]{1,2}%' | sed -e 's/%//g')"
    fi
    # this is actually shown in the status bar
    echo "set dl_stat = $COUNTER:${REM:-?}%" > $4
    sleep "$SECS"
done;
echo "set dl_stat = " > $4
 
rm -f "$STAT"
 
exit 0

Btw, anyone got the adblock script working? smile


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#13 2010-04-18 13:24:03

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Uzbl] 3 [solved] questions

I'd recommend privoxy for ad blocking.

Offline

#14 2010-04-18 13:37:32

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Uzbl] 3 [solved] questions

skottish wrote:

I'd recommend privoxy for ad blocking.

Could you please show me how I can use uzbl with privoxy?


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#15 2010-04-18 15:21:03

Nepherte
Member
From: Singapore
Registered: 2008-09-09
Posts: 427

Re: [Uzbl] 3 [solved] questions

Install privoxy:

pacman -Sy privoxy

Start privoxy:

/etc/rc.d/privoxy start

Set the proxy in uzbl by adding the following in ~/.config/uzbl/config:

set proxy_url = http://127.0.0.1:8118

Offline

#16 2010-04-18 21:31:36

Soupstuffs
Member
Registered: 2009-08-28
Posts: 42

Re: [Uzbl] 3 [solved] questions

Wow, awesome! Has the whole security thing with the follow link in new tab via keyboard been fixed as well?

Offline

#17 2010-04-18 21:36:11

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Uzbl] 3 [solved] questions

Nepherte wrote:

Install privoxy:

pacman -Sy privoxy

Start privoxy:

/etc/rc.d/privoxy start

Set the proxy in uzbl by adding the following in ~/.config/uzbl/config:

set proxy_url = http://127.0.0.1:8118

I'm using privoxy with uzbl right now and it seems to work quite well, thank you for the hint.
However, I need to test it a bit more extensively as in certain sites it seems to slow down navigation a bit, but it might be a case.


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#18 2010-04-19 00:35:23

&#32 Greg
Member
Registered: 2009-02-08
Posts: 80

Re: [Uzbl] 3 [solved] questions

Soupstuffs wrote:

Wow, awesome! Has the whole security thing with the follow link in new tab via keyboard been fixed as well?

No, the Uzbl.run object still is disabled because javascript applications can use it to spawn scripts on your computer. However, there is a workaround so you can... well, follow in new tab with the keyboard.

Offline

#19 2010-04-19 13:45:04

alterecco
Member
Registered: 2009-07-13
Posts: 152

Re: [Uzbl] 3 [solved] questions

Soupstuffs wrote:

Wow, awesome! Has the whole security thing with the follow link in new tab via keyboard been fixed as well?

JS scripts using window.open are now allowed to open new windows if `javascript_windows' is true

Offline

#20 2010-04-21 01:56:51

cteampride
Member
Registered: 2010-01-10
Posts: 15

Re: [Uzbl] 3 [solved] questions

im using JohannesSM64's solution as well.  never knew about that, seems to have no effect on browsing speed

Offline

Board footer

Powered by FluxBB