diff options
author | Tom Adams <tom@holizz.com> | 2009-08-26 09:47:46 +0100 |
---|---|---|
committer | Tom Adams <tom@holizz.com> | 2009-08-26 09:47:46 +0100 |
commit | 254e4a473fc96b6418c348fcfdf0a49c30b2a035 (patch) | |
tree | 53de5f0110ccffdc040e7d8d6c6c30b8fae6b783 /examples | |
parent | 36859a3a174387421dd4397f5f14a3f62b0deeed (diff) | |
parent | 8cfc268b053c0b5a8afc3f6d85c1e31518a6644c (diff) |
Merge branch 'experimental' into bf2
Conflicts:
examples/config/uzbl/config
Diffstat (limited to 'examples')
-rw-r--r-- | examples/config/uzbl/config | 1 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/download.sh | 3 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/scheme.py | 23 |
3 files changed, 27 insertions, 0 deletions
diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index 890a0b9..efc4780 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -8,6 +8,7 @@ set download_handler = spawn $XDG_DATA_HOME/uzbl/scripts/download.sh set cookie_handler = spawn $XDG_DATA_HOME/uzbl/scripts/cookies.py #set new_window = sh 'echo uri "$8" > $4' # open in same window set new_window = sh 'uzbl -u $8' # equivalent to the default behaviour +set scheme_handler = spawn $XDG_DATA_HOME/uzbl/scripts/scheme.py set load_start_handler = chain 'set keycmd = ' 'set status_message = <span foreground="khaki">wait</span>' set load_commit_handler = set status_message = <span foreground="green">recv</span> set load_finish_handler = chain 'set status_message = <span foreground="gold">done</span>' 'spawn $XDG_DATA_HOME/uzbl/scripts/history.sh' diff --git a/examples/data/uzbl/scripts/download.sh b/examples/data/uzbl/scripts/download.sh index aa1ca09..c8eb6ba 100755 --- a/examples/data/uzbl/scripts/download.sh +++ b/examples/data/uzbl/scripts/download.sh @@ -8,6 +8,9 @@ GET="wget --user-agent=Firefox" dest="$HOME" 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 diff --git a/examples/data/uzbl/scripts/scheme.py b/examples/data/uzbl/scripts/scheme.py new file mode 100755 index 0000000..7286703 --- /dev/null +++ b/examples/data/uzbl/scripts/scheme.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import os, subprocess, sys, urlparse + +def detach_open(cmd): + # Thanks to the vast knowledge of Laurence Withers (lwithers) and this message: + # http://mail.python.org/pipermail/python-list/2006-November/587523.html + if not os.fork(): + null = os.open(os.devnull,os.O_WRONLY) + for i in range(3): os.dup2(null,i) + os.close(null) + subprocess.Popen(cmd) + print 'USED' + +if __name__ == '__main__': + uri = sys.argv[8] + u = urlparse.urlparse(uri) + if u.scheme == 'mailto': + detach_open(['xterm', '-e', 'mail %s' % u.path]) + elif u.scheme == 'xmpp': + detach_open(['gajim-remote', 'open_chat', uri]) + elif u.scheme == 'git': + detach_open(['git', 'clone', uri], cwd=os.path.expanduser('~/src')) |