~thecatster/.files

5fb41cf41c8f0f25a2fc4af6c5cdec9c672c545f — Daniel Rose 3 years ago 5210204
Fix nyxt init.lisp tangling
2 files changed, 77 insertions(+), 2 deletions(-)

M nyxt.org
A nyxt/init.lisp
M nyxt.org => nyxt.org +1 -2
@@ 4,14 4,13 @@
#+LANGUAGE: en
#+OPTIONS: num:nil
#+ATTR_HTML: :style margin-left: auto; margin-right: auto;
#+PROPERTY: header-args :tangle nyxt/init.lisp :tangle-mode (identity #o444) :mkdirp yes

Configuration for Nyxt browser, my favourite non-Firefox browser. Once
WebExtensions are available, this will definitely be my main browser.

* ~init.lisp~

#+BEGIN_SRC lisp
#+BEGIN_SRC lisp :tangle nyxt/init.lisp :mkdirp yes
;; Custom configuration for Nyxt
(in-package #:nyxt-user)


A nyxt/init.lisp => nyxt/init.lisp +76 -0
@@ 0,0 1,76 @@
;; Custom configuration for Nyxt
(in-package #:nyxt-user)

(dolist (file (list (nyxt-init-file "keymap.lisp")
                    (nyxt-init-file "colorscheme.lisp")))
  (load file))
;; (load-after-system :nx-kaomoji (nyxt-init-file "kaomoji.lisp"))
;; (load-after-system :nx-ace (nyxt-init-file "ace.lisp"))
;; (load-after-system :slynk (nyxt-init-file "slynk.lisp"))

;; Don't popup to restore history; just do it.
(define-configuration browser
    ((session-restore-prompt :always-restore)))

;; Set default actions for certain URLs such as opening files in Emacs
(defun old-reddit-handler (request-data)
  (let ((url (url request-data)))
    (setf (url request-data)
          (if (search "reddit.com" (quri:uri-host url))
              (progn
                (setf (quri:uri-host url) "old.reddit.com")
                (log:info "Switching to old Reddit: ~s" (render-url url))
                url)
              url)))
  request-data)

(define-configuration web-buffer
  ((request-resource-hook
    (hooks:add-hook %slot-default% (make-handler-resource #'old-reddit-handler)))))

(define-configuration buffer
    ((request-resource-hook (reduce #'hooks:add-hook
                                    (list (url-dispatching-handler
                                           'transmission-magnet-links
                                           (match-scheme "magnet")
                                           "transmission-remote --add ~a")
                                          (url-dispatching-handler
                                           'emacs-file
                                           (match-scheme "file")
                                           (lambda (url)
                                             (uiop:launch-program
                                              `("emacs" ,(quri:uri-path url)))
                                             nil)))
                                    :initial-value %slot-default%))))

(define-configuration (buffer internal-buffer editor-buffer prompt-buffer)
    ((default-modes `(emacs-mode ,@%slot-default%))
     (download-engine :renderer)
     (conservative-word-move t)))

(define-configuration (web-buffer nosave-buffer)
    ((default-modes `(emacs-mode
                      blocker-mode
                      reduce-tracking-mode
                      ;; force-https-mode Causing issues, can't temporarily disable this.
                      certificate-exception-mode
                      auto-mode
                      ,@%slot-default%))))

(setf nyxt/certificate-exception-mode:*default-certificate-exceptions*
      '("192.168.1.1" "192.168.1.36" "192.168.1.201" "192.168.1.200" "patsa.org"))

(define-configuration prompt-buffer
    ((hide-single-source-header-p t)))

(define-configuration nosave-buffer
    ((default-modes `(proxy-mode ,@%slot-default%))))

(define-configuration nyxt/web-mode:web-mode
    ;; QWERTY home row.
    ((nyxt/web-mode:hints-alphabet "DSJKHLFAGNMXCWEIO")
     (glyph "ω")))

(define-configuration nyxt/auto-mode:auto-mode
    ((nyxt/auto-mode:prompt-on-mode-toggle t)
     (glyph "α")))