From f8ed532b293a65ab1bc870238560f981a7151908 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Thu, 2 Jul 2020 12:24:18 +0200 Subject: [PATCH] Nyxt: Add magnet handler. --- .config/nyxt/init.lisp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.config/nyxt/init.lisp b/.config/nyxt/init.lisp index aa9148f6..c414f002 100644 --- a/.config/nyxt/init.lisp +++ b/.config/nyxt/init.lisp @@ -71,6 +71,16 @@ Videos are downloaded with `+youtube-dl-command+'." uri))) request-data) +(defun magnet-handler (request-data) + (let ((uri (url request-data))) + (if (string= (quri:uri-scheme uri) "magnet") + (progn + (echo "Opened magnet link in Transmission.") + ;; (uiop:run-program (list "transmission-remote" "--add" (object-string uri))) + (uiop:launch-program (list "transmission-remote" "--add" (object-string uri))) + (values request-data :stop)) + request-data))) + (defvar *my-unproxied-domains* '("jit.si" "steampowered.com")) @@ -111,7 +121,8 @@ Videos are downloaded with `+youtube-dl-command+'." (request-resource-hook (reduce #'hooks:add-hook (mapcar #'make-handler-resource (list - #'auto-proxy-handler + ;; #'auto-proxy-handler + #'magnet-handler #'old-reddit-handler)) :initial-value %slot-default))))