diff options
Diffstat (limited to '.config/nyxt/config.lisp')
-rw-r--r-- | .config/nyxt/config.lisp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/.config/nyxt/config.lisp b/.config/nyxt/config.lisp index 6540815..eb70295 100644 --- a/.config/nyxt/config.lisp +++ b/.config/nyxt/config.lisp @@ -17,7 +17,7 @@ Extension files (like dark-reader.lisp) are to append to this list. Why the variable? Because it's too much hassle copying it everywhere.") (define-nyxt-user-system-and-load nyxt-user/basic-config - :components ("keys" "colors" "commands")) + :components ("keys" "style" "commands")) (define-configuration (:modable-buffer :prompt-buffer :editor-buffer) "Set up Emacs keybindings everywhere possible." @@ -52,3 +52,54 @@ Upstream Nyxt doesn't have it because it may break some websites.") (preferred-user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" :doc "Mimic Chrome on MacOS."))) + + +(defparameter old-reddit-handler + (url-dispatching-handler + 'old-reddit-dispatcher + (match-host "www.reddit.com") + (lambda (url) + (quri:copy-uri url :host "old.reddit.com")))) + + +(defun old-reddit-handler (request-data) + (let ((url (url request-data))) + (setf (url request-data) + (if (search "reddit.com" (quri.uri:uri-host url)) + (progn + (setf (quri.uri:uri-host url) "old.reddit.com") + (log:info "Switching to old Reddit: ~s" + (render-url url)) + url) + url))) + request-data) + +(url-dispatching-handler 'old-reddit-handler ) + + +(define-configuration web-buffer + (request-resource-hook + (hooks:add-hook %slot-value% + (url-dispatching-handler + 'doi-link-dispatcher + (match-scheme "doi") + (lambda (url) + (quri:uri (format nil "https://www.reddit.com/~a" + (quri:uri-path url)))))))) + +(defmethod customize-instance ((buffer web-buffer)) + (hooks:add-hook + (request-resource-hook buffer) + (url-dispatching-handler + 'transmission-magnet-links + (match-scheme "magnet") + "transmission-remote --add ~a")) + (hooks:add-hook + (request-resource-hook buffer) + (url-dispatching-handler + 'emacs-file + (match-scheme "file") + (lambda (url) + (uiop:launch-program + `("emacs" ,(quri:uri-path url))) + nil)))) |