From 99f25785034400571f988346d357f792e0fdafdd Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sat, 4 Jan 2014 16:16:02 +0100 Subject: [PATCH] dwb: magnet, ftp and mailto content support --- .config/dwb/settings | 2 +- .config/dwb/userscripts/extension_loader.js | 61 ++++++++++++--------- .config/transmission-daemon/settings.json | 4 +- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.config/dwb/settings b/.config/dwb/settings index 3633fe43..43740e0f 100644 --- a/.config/dwb/settings +++ b/.config/dwb/settings @@ -140,7 +140,7 @@ scroll-step=0.00 close-last-tab-policy=clear foreground-color=#ffffff message-delay=2 -scheme-handler=dwb-scheme +scheme-handler= default-font-size=12 enable-offline-web-application-cache=true hints-key-lock=250 diff --git a/.config/dwb/userscripts/extension_loader.js b/.config/dwb/userscripts/extension_loader.js index c1c0ecd0..a39e8eb5 100644 --- a/.config/dwb/userscripts/extension_loader.js +++ b/.config/dwb/userscripts/extension_loader.js @@ -4,25 +4,25 @@ extensions.load("adblock_subscriptions", { //adblock_subscriptions___CONFIG }); @@ -36,13 +36,13 @@ forwardBind : "]]", // Shortcut for navigating to the previous page backBind : "[[", -// Go up one directory, e.g. from http://www.example.com/foo/bar to +// Go up one directory, e.g. from http://www.example.com/foo/bar to // http://www.example.com/foo -updirBind : "gu", +updirBind : "gu", -// Go to top directory, e.g. from http://www.example.com/foo/bar to +// Go to top directory, e.g. from http://www.example.com/foo/bar to // http://www.example.com -topdirBind : "gU", +topdirBind : "gU", // Patterns to match against when searching for "next"-links nextPatterns : "next,more,>,\u2192,\xbb,\u226b,>>", @@ -58,14 +58,14 @@ previousPatterns : "prev,previous,back,<,\u2190,\xab,\u226a,<<" extensions.load("autoquvi", { //autoquvi___CONFIG @@ -93,10 +93,10 @@ extensions.load("downloadhandler", { // // mimeType : a mimetype, optional // - + // { command : "xpdf %f", mimeType : "application/pdf" } // { command : "xdvi %f", extension : "dvi" } - + ] //>downloadhandler___CONFIG }); @@ -108,23 +108,34 @@ extensions.load("contenthandler", { // %u will be replaced with the uri of the request, if the handler is a // function the first parameter of the function will be the uri and the // function must return the command to execute. - + // Handle requests based on filename extension extension : { - // "torrent" : "xterm -e 'aria2 %u'", + // "torrent" : "xterm -e 'aria2 %u'", // "pdf" : "xterm -e 'wget %u --directory-prefix=~/mypdfs'" }, // Handle requests based on URI scheme uriScheme : { - //ftp : function(uri) { - // if (uri[uri.length-1] == "/") - // return "xterm -e 'ncftp " + uri + "'"; - // else - // return "xterm -e 'ncftpget " + uri + "'"; - //} + ftp : function(uri) { + if (uri[uri.length-1] == "/") + return "xterm -e 'ncftp " + uri + "'"; + else + return "xterm -e 'ncftpget " + uri + "'"; + }, - magnet: "transmission-remote -a '%u'" + // We need to use 'sh -c' since we need to use a pipe so that xclip can + // read from stdin + mailto : function(uri) { + uri=uri.replace(/mailto:/, "") + uri=uri.replace(/\?/, " ") + return "sh -c ' echo " + uri + " | xclip -i'"; + }, + + // 'trc' is a wrapper script that will launch transmission-daemon if not + // already started. + // magnet: "transmission-remote -a '%u'" + magnet: "trc -a '%u'" }, // Handle requests based on MIME type diff --git a/.config/transmission-daemon/settings.json b/.config/transmission-daemon/settings.json index 78d1a443..46eed40f 100644 --- a/.config/transmission-daemon/settings.json +++ b/.config/transmission-daemon/settings.json @@ -12,10 +12,10 @@ "blocklist-url": "http://www.example.com/blocklist", "cache-size-mb": 4, "dht-enabled": true, - "download-dir": "/home/peter/Downloads", + "download-dir": "/home/peter/temp", "download-queue-enabled": true, "download-queue-size": 5, - "encryption": 1, + "encryption": 2, "idle-seeding-limit": 30, "idle-seeding-limit-enabled": false, "incomplete-dir": "/home/peter/Downloads",