(in-package #:nyxt-user) #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) (load "~/.config/nyxt/style.lisp") (load "~/.config/nyxt/keys.lisp") (load "~/.config/nyxt/default-search.lisp") (defvar *web-buffer-modes* '(:emacs-mode ;; :blocker-mode :force-https-mode :reduce-tracking-mode :user-script-mode :bookmarklets-mode) "The modes to enable in any web-buffer by default. Extension files (like dark-reader.lisp) are to append to this list.") (define-configuration (:modable-buffer :prompt-buffer :editor-buffer) "Set up Emacs keybindings everywhere possible." ((default-modes `(:emacs-mode ,@%slot-value%)))) (define-configuration :prompt-buffer "Make the attribute widths adjust to the content in them. It's not exactly necessary on master, because there are more or less intuitive default widths, but these are sometimes inefficient (and note that I made this feature so I want to have it :P)." ((dynamic-attribute-width-p t))) (define-configuration :web-buffer "Basic modes setup for web-buffer." ((default-modes `(,@*web-buffer-modes* ,@%slot-value%)))) (define-configuration :hint-mode "Set up QWERTY home row as the hint keys." ((hints-alphabet "DSJKHLFAGNMXCWEIO"))) (defmethod files:resolve ((profile nyxt:nyxt-profile) (file nyxt/mode/bookmark:bookmarks-file)) "Reroute the bookmarks to the config directory." #p"~/.config/nyxt/bookmarks.lisp") (define-configuration :reduce-tracking-mode ((query-tracking-parameters (append '("utm_source" "utm_medium" "utm_campaign" "utm_term" "utm_content") %slot-value%) :doc "This is to strip UTM-parameters off all the links. 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/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15" :doc "Mimic Chrome on MacOS."))) (defun redlib-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) "redlib.pussthecat.org") (log:info "Switching to old Reddit: ~s" (render-url url)) url) url))) request-data) (defun invidious-handler (request-data) (let ((url (url request-data))) (setf (url request-data) (if (search "youtube.com" (quri.uri:uri-host url)) (progn (setf (quri.uri:uri-host url) "yewtu.be") (log:info "Switching to invidious: ~s" (render-url url)) url) url))) request-data) (define-configuration web-buffer ((request-resource-hook (progn (serapeum:add-hook %slot-default% 'redlib-handler) (serapeum:add-hook %slot-default% 'invidious-handler)))))