From db2e79ca5154e5b7460c7f4f2f50612fe8203456 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 29 Jan 2024 06:08:00 +0200 Subject: Add nyxt configuration --- .config/nyxt/colorscheme.lisp | 113 ++++++++++++++++++++++++++++++++++++++++++ .config/nyxt/config.lisp | 89 +++++++++++++++++++++++++++++++++ .config/nyxt/keybinds.lisp | 34 +++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 .config/nyxt/colorscheme.lisp create mode 100644 .config/nyxt/config.lisp create mode 100644 .config/nyxt/keybinds.lisp diff --git a/.config/nyxt/colorscheme.lisp b/.config/nyxt/colorscheme.lisp new file mode 100644 index 0000000..17264be --- /dev/null +++ b/.config/nyxt/colorscheme.lisp @@ -0,0 +1,113 @@ + +(in-package #:nyxt-user) + +;; This automatically darkens WebKit-native interfaces and sends the +;; "prefers-color-scheme: dark" to all the supporting websites. +(setf (uiop:getenv "GTK_THEME") "Adwaita:dark") + +;; badger colorscheme, from doom-themes +(defvar badger-bg "#171717") +(defvar badger-bg-alt "#2f2f2f") +(defvar badger-base-01 "#1D1D1D") +(defvar badger-base-04 "#433F4f") +(defvar badger-fg "#F6F3E8") +(defvar badger-red "#E2434C") +(defvar badger-orange "#EA9847") +(defvar badger-green "#86B187") +(defvar badger-teal "#65A399") +(defvar badger-yellow "#E0D063") +(defvar badger-blue "#8AC6F2") +(defvar badger-magenta "#E18Cbb") +(defvar badger-violet "#BF93C3") +(defvar badger-dark-cyan "#5699AF") +(defvar badger-dark-violet "#635770") +(defvar badger-olive "#9AA68E") +(defvar badger-dull-red "#A55662") + + +(defvar old-hope-red "#ea3d54") +(defvar old-hope-bg "#1c1d20") +(defvar old-hope-bg-alt "#151619") + +(defvar monokai-dark-blue "#727280") +(defvar monokai-orange "#FD971F") + +(defvar gruvbox-red "#fb4934") +(defvar gruvbox-orange "#fe8019") + +(defvar bg-magenta-intense "#7030af") +(defvar bg-red-subtle "#620f2a") +(defvar bg-green-subtle "#00422a") +(defvar bg-yellow-nuanced "#381d0f") +(defvar lavendar-bg "#38325c") + +(defvar default-dark-theme + (make-instance 'theme:theme + :background-color- "#333333" + :background-color "#121212" + :background-color+ "#000000" + :primary-color- "#d7752f" + :primary-color "#e48d4e" + :primary-color+ "#efa671" + :secondary-color- "#9f592d" + :secondary-color "#844115" + :secondary-color+ "#683008" + :action-color- "#763df2" + :action-color "#571fd2" + :action-color+ "#481fa2" + :highlight-color- "#ea43dd" + :highlight-color "#f46de8" + :highlight-color+ "#fc83f2" + :success-color- "#05f4cd" + :success-color "#4cfbcf" + :success-color+ "#87fcdf" + :warning-color- "#fca904" + :warning-color "#fcba04" + :warning-color+ "#ffd152" + :codeblock-color- "#44355a" + :codeblock-color "#2e243d" + :codeblock-color+ "#221a2d" + :text-color- "#dedede" + :text-color "#ededed" + :text-color+ "#ffffff" + :contrast-text-color "#0c0c0d")) + +(defvar thanos/dark-theme + (make-instance 'theme:theme + :background-color- badger-bg-alt + :background-color badger-bg + :background-color+ gruvbox-orange + :primary-color- "red" + :primary-color badger-base-04 + :primary-color+ "#efa671" + :secondary-color- "#9f592d" + :secondary-color badger-bg-alt + :secondary-color+ "#683008" + :action-color- gruvbox-red + :action-color gruvbox-red + :action-color+ gruvbox-red + :highlight-color- "#ea43dd" + :highlight-color badger-orange + :highlight-color+ "#fc83f2" + :success-color- "#05f4cd" + :success-color badger-green + :success-color+ "#87fcdf" + :warning-color- "red" + :warning-color badger-red + :warning-color+ "red" + :codeblock-color- "red" + :codeblock-color badger-bg-alt + :text-color- badger-fg + :text-color badger-fg + :text-color+ badger-fg + :contrast-text-color badger-fg + :font-family "Jetbrains Mono" + :monospace-font-family "Jetbrains Mono")) + +(define-configuration browser + ((theme thanos/dark-theme + :doc + "Covers all the semantic groups (warning-color, codeblock-color etc.) +Note that you can also define more nuanced colors, like warning-color+, so +that the interface gets even nicer. Otherwise Nyxt generates the missing colors +automatically, which should be good enough... for most cases."))) diff --git a/.config/nyxt/config.lisp b/.config/nyxt/config.lisp new file mode 100644 index 0000000..6300ad7 --- /dev/null +++ b/.config/nyxt/config.lisp @@ -0,0 +1,89 @@ +(in-package #:nyxt-user) + +#-quicklisp +(let ((quicklisp-init + (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) + +(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. + +Why the variable? Because it's too much hassle copying it everywhere.") + +(define-nyxt-user-system-and-load nyxt-user/basic-config + :components ("keybinds" "colorscheme")) + + +(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 +;; ((search-always-auto-complete-p +;; nil +;; :doc "I don't like search completion when I don't need it.") +;; (global-history-p +;; t +;; :doc "It was disabled after 2.2.4, while being a useful feature. +;; I'm forcing it here, because I'm getting lost in buffer-local +;; histories otherwise..."))) + +(define-configuration :web-buffer + "Basic modes setup for web-buffer." + ((default-modes `(,@*web-buffer-modes* ,@%slot-value%)))) + +;; (define-configuration :browser +;; "Set new buffer URL (a.k.a. start page, new tab page)." +;; ((default-new-buffer-url (quri:uri "nyxt:nyxt/mode/repl:repl")))) + +(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/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" + :doc "Mimic Chrome on MacOS."))) + +;; Search engines + + +(defvar *my-search-engines* + (list + '("google" "https://google.com/search?q=~a" "https://google.com") + '("doi" "https://dx.doi.org/~a" "https://dx.doi.org/") + '("python3" "https://docs.python.org/3/search.html?q=~a" + "https://docs.python.org/3") + '("duck" "https://duckduckgo.com/?q=~a" "https://duckduckgo.com")) + "List of search engines.") + +(define-configuration context-buffer + "Go through the search engines above and make-search-engine out of them." + ((search-engines + (append %slot-default% + (mapcar + (lambda (engine) (apply 'make-search-engine engine)) + *my-search-engines*))))) diff --git a/.config/nyxt/keybinds.lisp b/.config/nyxt/keybinds.lisp new file mode 100644 index 0000000..2eb5116 --- /dev/null +++ b/.config/nyxt/keybinds.lisp @@ -0,0 +1,34 @@ +(in-package #:nyxt-user) + +(define-configuration :document-mode + "Add basic keybindings." + ((keyscheme-map + (keymaps:define-keyscheme-map + "custom" (list :import %slot-value%) + ;; If you want to have VI bindings overriden, just use + ;; `scheme:vi-normal' or `scheme:vi-insert' instead of + ;; `scheme:emacs'. + nyxt/keyscheme:emacs + (list "C-c p" 'copy-password + "C-c y" 'autofill + "C-f" :history-forwards-maybe-query + "C-i" :input-edit-mode + "M-:" 'eval-expression + "C-s" :search-buffer + "C-x 3" 'hsplit + "C-x 1" 'close-all-panels + "C-'" (lambda-command insert-left-angle-quote () + (ffi-buffer-paste (current-buffer) "«")) + "C-M-'" (lambda-command insert-left-angle-quote () + (ffi-buffer-paste (current-buffer) "»")) + "C-M-hyphen" (lambda-command insert-left-angle-quote () + (ffi-buffer-paste (current-buffer) "—")) + "C-M-_" (lambda-command insert-left-angle-quote () + (ffi-buffer-paste (current-buffer) "–")) + "C-E" (lambda-command small-e-with-acute () + (ffi-buffer-paste (current-buffer) "é")) + "C-A" (lambda-command small-a-with-acute () + (ffi-buffer-paste (current-buffer) "á")) + "C-I" (lambda-command small-i-diaeresis () + (ffi-buffer-paste (current-buffer) "ï")) + "C-h hyphen" 'clcs-lookup))))) -- cgit v1.2.3