adding nyxt and zola base

This commit is contained in:
Chris Cochrun 2023-07-03 09:19:49 -05:00
parent f7c0143e18
commit 240df1fa41
17 changed files with 8481 additions and 337 deletions

View file

@ -138,7 +138,7 @@ bind = SUPER,w,exec,/home/chris/bin/window.sh
bind = SUPER,E,exec,/home/chris/bin/emacslof
bind = SUPER,d,exec,emacsclient -c -e '(dired-jump)'
bind = SUPER,v,exec,emacsclient -e '(chris/dired-open-videos)'
bind = SUPER,B,exec,/home/chris/bin/fflof
bind = SUPER,B,exec,/home/chris/bin/nyxtlof
bind = SUPER,A,exec,alacritty --class pulsemixer -e pulsemixer
bind = SUPERCTRL,i,exec,alacritty --class btop -e btop
bind = ,Print,exec,screenshot

View file

View file

@ -1,16 +0,0 @@
(DEFINE-CONFIGURATION NYXT/REDUCE-TRACKING-MODE:REDUCE-TRACKING-MODE
((VISIBLE-IN-STATUS-P NIL)))
(DEFINE-CONFIGURATION NYXT/FORCE-HTTPS-MODE:FORCE-HTTPS-MODE
((VISIBLE-IN-STATUS-P NIL)))
(DEFINE-CONFIGURATION NYXT/AUTO-MODE:AUTO-MODE
((VISIBLE-IN-STATUS-P NIL)))
(DEFINE-CONFIGURATION NYXT/CERTIFICATE-EXCEPTION-MODE:CERTIFICATE-EXCEPTION-MODE
((VISIBLE-IN-STATUS-P NIL)))
(DEFINE-CONFIGURATION NYXT/HELP-MODE:HELP-MODE
((VISIBLE-IN-STATUS-P NIL)))
(DEFINE-CONFIGURATION NYXT/WEB-MODE:WEB-MODE
((VISIBLE-IN-STATUS-P NIL)))
(DEFINE-CONFIGURATION NYXT/VI-MODE:USER-VI-NORMAL-MODE
((VISIBLE-IN-STATUS-P NIL)))
(DEFINE-CONFIGURATION BUFFER
((CURRENT-ZOOM-RATIO 0.75)))

215
.config/nyxt/config.lisp Normal file
View file

@ -0,0 +1,215 @@
(in-package #:nyxt-user) ; While implicit, this allows SLY to know which package we are in.
#+nyxt-3 (reset-asdf-registries)
(defvar *web-buffer-modes*
'(: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.")
;; Create a function to launch mpv with given url
(defun mpv (url)
"MPV launches with given url using the fast profile."
(uiop:launch-program (list "mpv" "--profile=fast" url "&")))
;; Create a function to download videos with youtube-dl in alacritty
(defun youtube-dl (url)
"Download videos and audio with youtube-dl in alacritty for feedback"
(uiop:launch-program
(list "dlvideo" url)))
(define-configuration :web-buffer
((default-modes (append (list :vi-normal-mode) %slot-value%))))
(define-configuration (:modable-buffer :prompt-buffer :editor-buffer)
"Set up Emacs keybindings everywhere possible.
If you're the VI person, then use this:
(define-configuration :web-buffer
((default-modes (append (list :vi-normal-mode) %slot-value%))))
You probably want to stay with CUA in :prompt-buffer, because it's too
weird using it with VI bindings. But if you're feeling risky, then:
(define-configuration :prompt-buffer
((default-modes (append (list :vi-insert-mode) %slot-value%))))"
((default-modes `(:vi-insert-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 :prompt-buffer
((hide-single-source-header-p
t
:doc "This is to hide the header is there's only one source.
There also used to be other settings to make prompt-buffer a bit
more minimalist, but those are internal APIs :(")))
(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 :nosave-buffer
"Enable proxy in nosave (private, incognito) buffers."
((default-modes `(:proxy-mode ,@*web-buffer-modes* ,@%slot-value%))))
(define-configuration :hint-mode
"Set up QWERTY home row as the hint keys."
((hints-alphabet "DSJKHLFAGNMXCWEIO")))
(defmethod ffi-buffer-make :after ((buffer nyxt/renderer/gtk::gtk-buffer))
"Setting WebKit-specific settings.
WARNING: Not exactly the best way to configure Nyxt, because it relies
on internal APIs and CFFI...
See
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html
for the full list of settings you can tweak this way."
(when (slot-boundp buffer 'nyxt/renderer/gtk::gtk-object)
(let* ((settings (webkit:webkit-web-view-get-settings
(nyxt/renderer/gtk::gtk-object buffer))))
(setf
;; Resizeable textareas. It's not perfect, but still a cool feature to have.
(webkit:webkit-settings-enable-resizable-text-areas settings) t
;; Write console errors/warnings to the shell, to ease debugging.
(webkit:webkit-settings-enable-write-console-messages-to-stdout settings) t
;; "Inspect element" context menu option available at any moment.
(webkit:webkit-settings-enable-developer-extras settings) t
;; Enable WebRTC.
(webkit:webkit-settings-enable-media-stream settings) t
;; Use Cantarell-18 as the default font.
(webkit:webkit-settings-default-font-family settings) "VictorMono Nerd Font"
(webkit:webkit-settings-default-font-size settings) 16
;; Use Hack-17 as the monospace font.
(webkit:webkit-settings-monospace-font-family settings) "VictorMono Nerd Font"
(webkit:webkit-settings-default-monospace-font-size settings) 14
;; Use Unifont for pictograms.
(webkit:webkit-settings-pictograph-font-family settings) "Unifont")))
;; Set the view background to black.
(cffi:foreign-funcall
"webkit_web_view_set_background_color"
:pointer (g:pointer (nyxt/renderer/gtk:gtk-object buffer))
;; GdkRgba is simply an array of four doubles.
:pointer (cffi:foreign-alloc
:double
:count 4
;; red green blue alpha
:initial-contents '(0d0 0d0 0d0 1d0))))
;; (defmethod customize-instance ((input-buffer input-buffer) &key)
;; (disable-modes* 'nyxt/mode/emacs:emacs-mode input-buffer)
;; (enable-modes* 'nyxt/mode/vi:vi-normal-mode input-buffer))
;; (define-configuration browser
;; ((external-editor-program '("emacsclient -c"))))
;; Let's create a function to hint videos, convert the url to a sting, and play them in MPV
(define-command hint-mpv nil
"Show a set of element hints, and copy the URL of the user inputted one."
(nyxt/mode/hint:query-hints "Copy element URL"
(lambda (nyxt/mode/hint::results)
;; this converts the url to a string to be used in mpv
(let*
((url
(format nil "~a"
(url (first nyxt/mode/hint::results)))))
;; here we take that string and pipe it into mpv
(mpv url)))))
;; Let's create a function to hint videos, convert the url to a sting, and download with ytdl
(define-command hint-ytdl nil
"Show a set of element hints, and copy the URL of the user inputted one."
(nyxt/mode/hint:query-hints "Copy element URL"
(lambda (nyxt/mode/hint::results)
;; this converts the url to a string to be used in yt-dlp
(let*
((url
(format nil "~a"
(url (first nyxt/mode/hint::results)))))
;; here we take that string and pipe it into yt-dlp
(youtube-dl url)))))
(define-configuration :web-buffer
"set better scroll distance"
((scroll-distance 350)))
(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:vi-normal
(list "K" 'switch-buffer-next
"J" 'switch-buffer-previous
"b" 'switch-buffer
"d" 'delete-current-buffer
"D" 'delete-buffer
"r" 'reload-current-buffer
"R" 'reload-buffers
"v" 'hint-mpv
"V" 'hint-ytdl
"L" 'history-forwards
"H" 'history-backwards
"gv" :visual-mode
"C-i" :input-edit-mode)))))
(defvar *my-search-engines*
(list
'("google" "https://google.com/search?q=~a" "https://google.com")
'("searx" "https://search.tfcconnection.org/search?q=~a" "https://search.tfcconnection.org/"))
"List of search engines.")
(define-configuration context-buffer
"Go through the search engines above and make-search-engine out of them."
((search-engines
(append
(mapcar (lambda (engine) (apply 'make-search-engine engine))
*my-search-engines*)
%slot-default%))))
(define-nyxt-user-system-and-load "nyxt-user/search-engines"
:depends-on (:nx-search-engines) :components ("search-engines.lisp"))
(define-nyxt-user-system-and-load "nyxt-user/dark-reader"
:components ("dark-reader.lisp")
:depends-on (:nx-dark-reader))
;; (define-configuration :prompt-buffer-mode
;; "Add basic keybindings for prompt-buffer."
;; ((keyscheme-map
;; (keymaps:define-keyscheme-map
;; "custom" (list :import %slot-value%)
;; nyxt/keyscheme:emacs
;; (list "C-j" 'nyxt/mode/prompt-buffer:next-suggestion
;; "C-k" 'nyxt/mode/prompt-buffer:previous-suggestion)))))
;; (define-configuration buffer
;; ((search-engines
;; (list
;; (make-instance 'search-engine
;; :shortcut "s"
;; :search-url "https://search.tfcconnection.org/?q=~a"
;; :fallback-url "https://search.tfcconnection.org")))))
;;; Loading files from the same directory.
(define-nyxt-user-system-and-load nyxt-user/basic-config
:components ("status" "style"))

View file

@ -0,0 +1,10 @@
(in-package #:nyxt-user)
(define-configuration nx-dark-reader:dark-reader-mode
((nxdr:brightness 80)
(nxdr:contrast 80)
(nxdr:text-color "white")))
;; Add dark-reader to default modes
;; (define-configuration web-buffer
;; ((default-modes `(nxdr:dark-reader-mode ,@%slot-value%))))

View file

@ -1,24 +0,0 @@
(in-package #:nyxt-user)
;;allow setting glyphs
(define-configuration status-buffer
((glyph-mode-presentation-p t)))
;;various glyph settings with no additional configs
(define-configuration nyxt/force-https-mode:force-https-mode ((glyph "ϕ")))
(define-configuration nyxt/blocker-mode:blocker-mode ((glyph "β")))
(define-configuration nyxt/proxy-mode:proxy-mode ((glyph "π")))
(define-configuration nyxt/reduce-tracking-mode:reduce-tracking-mode ((glyph "∅")))
(define-configuration nyxt/certificate-exception-mode:certificate-exception-mode ((glyph "ɛ")))
(define-configuration nyxt/style-mode:style-mode ((glyph "s")))
(define-configuration nyxt/help-mode:help-mode ((glyph "?")))
;;configure web mode hints to home row and set glyph
(define-configuration nyxt/web-mode:web-mode
((nyxt/web-mode:hints-alphabet "ASDFGHJKL")
(glyph "ω")))
;;auto-mode config and set glyph
(define-configuration nyxt/auto-mode:auto-mode
((nyxt/auto-mode:prompt-on-mode-toggle t)
(glyph "α")))

25
.config/nyxt/hsplit.lisp Normal file
View file

@ -0,0 +1,25 @@
(in-package #:nyxt-user)
(define-panel-command hsplit-internal (&key (url (quri:render-uri (url (current-buffer)))))
(panel "*Duplicate panel*" :right)
"Duplicate the current buffer URL in the panel buffer on the right.
A poor man's hsplit :)"
(setf (ffi-width panel) 550)
(run-thread "URL loader"
(sleep 0.3)
(buffer-load (quri:uri url) :buffer panel))
"")
(define-command-global close-all-panels ()
"Close all the panel buffers there are."
(alexandria:when-let ((panels (nyxt/renderer/gtk::panel-buffers-right (current-window))))
(delete-panel-buffer :window (current-window) :panels panels))
(alexandria:when-let ((panels (nyxt/renderer/gtk::panel-buffers-left (current-window))))
(delete-panel-buffer :window (current-window) :panels panels)))
(define-command-global hsplit ()
"Based on `hsplit-internal' above."
(if (nyxt/renderer/gtk::panel-buffers-right (current-window))
(delete-all-panel-buffers (current-window))
(hsplit-internal)))

View file

@ -1,255 +0,0 @@
(in-package #:nyxt-user) ; While implicit, this allows SLY to know which package we are in.
(dolist (file (list (nyxt-init-file "slynk.lisp"))))
(dolist (file (list (nyxt-init-file "glyphs.lisp"))))
(load-after-system :slynk (nyxt-init-file "slynk.lisp"))
;; (defvar *chris-prompt-keymap (make-keymap "chris-prompt-map"))
;; (define-key *chris-prompt-keymap*
;; "escape" 'cancel-input
;; "C-j" 'select-next
;; "C-k" 'select-previous)
;; (define-mode chris-prompt-mode ()
;; "Dummy mode for the custom key bindings in `*chris-prompt-keymap*'."
;; ((keymap-scheme (keymap:make-scheme
;; scheme:vi-insert *chris-prompt-keymap*))
;; (visible-in-status-p nil)))
;; Always restore history and don't ask
(define-configuration browser
((session-restore-prompt :always-restore)))
(define-configuration (prompt-buffer)
((default-modes
(append
'(vi-insert-mode)
%slot-default%))))
(define-configuration browser
((external-editor-program '("/usr/bin/emacsclient"))))
;; Create a function to launch mpv with given url
(defun mpv (url)
"MPV launches with given url using the fast profile."
(uiop:launch-program (list "mpv" "--profile=fast" url "&")))
;; Create a function to download videos with youtube-dl in alacritty
(defun youtube-dl (url)
"Download videos and audio with youtube-dl in alacritty for feedback"
(uiop:launch-program
(list "alacritty" "-e" "yt-dlp" "-o ~/Videos/%(title)s.%(ext)s" url)))
;; Let's create a function to hint videos, convert the url to a sting, and play them in MPV
(define-command hint-mpv (&key nyxt/web-mode::annotate-visible-only-p)
"Show a set of element hints, and copy the URL of the user inputted one."
(nyxt/web-mode:query-hints "Copy element URL"
(lambda (nyxt/web-mode::result)
;; this converts the url to a string to be used in mpv
(let*
((url
(format nil "~a"
(url (first nyxt/web-mode::result)))))
;; here we take that string and pipe it into mpv
(mpv url)))
:annotate-visible-only-p
nyxt/web-mode::annotate-visible-only-p))
;; Let's create a function to hint videos, convert the url to a sting, and download with ytdl
(define-command hint-ytdl (&key nyxt/web-mode::annotate-visible-only-p)
"Show a set of element hints, and copy the URL of the user inputted one."
(nyxt/web-mode:query-hints "Copy element URL"
(lambda (nyxt/web-mode::result)
;; this converts the url to a string to be used in yt-dlp
(let*
((url
(format nil "~a"
(url (first nyxt/web-mode::result)))))
;; here we take that string and pipe it into yt-dlp
(youtube-dl url)))
:annotate-visible-only-p
nyxt/web-mode::annotate-visible-only-p))
;; These are my own keys that are layered over vi-normal. A lot of these
;; are similar to qutebrowser.
(defvar *chris-keymap* (make-keymap "chris-map"))
(define-key *chris-keymap*
"K" 'switch-buffer-next
"J" 'switch-buffer-previous
"b" 'switch-buffer
"v" 'hint-mpv
"V" 'hint-ytdl
"d" 'delete-current-buffer
"D" 'delete-buffer
"r" 'reload-current-buffer
"R" 'reload-buffers)
(define-mode chris-mode ()
"Dummy mode for the custom key bindings in `*chris-keymap*'."
((keymap-scheme
(keymap:make-scheme
scheme:vi-normal *chris-keymap*))
(visible-in-status-p nil)))
(define-configuration buffer
((default-modes
(append
'(vi-normal-mode
auto-mode
reduce-tracking-mode
force-https-mode
chris-mode)
%slot-default%))))
(define-configuration buffer
((search-engines
(list
(make-instance 'search-engine
:shortcut "s"
:search-url "https://search.tfcconnection.org/?q=~a"
:fallback-url "https://search.tfcconnection.org")))))
(define-configuration nyxt/vi-mode:vi-normal-mode
((visible-in-status-p nil)))
(define-configuration nyxt/vi-mode:vi-insert-mode
((visible-in-status-p nil)))
(define-configuration status-buffer
((style
(str:concat
%slot-default%
(cl-css:css
'((body
:background "#282a36"
:color "#e2e4e5"
:line-height "1fr")
("#container-vi"
:grid-template-columns "0px 30px 2fr 0px 240px")
("#controls"
:background-color "#282a36"
:color "#f3f99d"
:width "0px"
:padding-left "0px"
:hidden)
("#url"
:background-color "#282a36"
:color "#5af78e")
("#modes"
:background-color "#282a36"
:color "#f3f99d")
("#tabs"
:background-color "#282a36"
:color "#5af78e")
(".tab"
:background-color "#282a36"
:color "#9aedfe")
(".tab:hover"
:background-color "#282a36"
:color "#f1f1f0")
(".button"
:background-color "#282a36"
:color "#5af78e")
(".button:hover"
:background-color "#282a36"
:color "#f1f1f0")
(".arrow"
:width "0px"
:height "0px")
(".arrow-right"
:background-color "#282a36"
:color "#5af78e")
(".arrow-left"
:background-color "#282a36"
:color "#5af78e")
))))))
(define-configuration internal-buffer
((style
(str:concat
%slot-default%
(cl-css:css
'((body
:background "#282a36"
:color "#e2e4e5")
(.button
:color "#e2e4e5")))))))
(define-configuration window
((message-buffer-style
(str:concat
%slot-default%
(cl-css:css
'((body
:background-color "#282a36"
:color "#e2e4e5")))))))
(define-configuration prompt-buffer
((style
(str:concat
%slot-default%
(cl-css:css
'((body
:background-color "#282a36"
:color "#e2e4e5")
("#prompt-area-vi"
:background-color "#282a36"
:color "#57c7ff")
("#prompt"
:background-color "#282a36"
:color "#e2e4e5")
("#input"
:background-color "#282a36"
:color "#e2e4e5")
("#suggestions"
:background-color "#282a36"
:color "#e2e4e5")
(.vi-insert-mode
:background-color "#282a36")
(.vi-normal-mode
:background-color "#282a36")
(.source
:margin-left "5px")
(.source-name
:background-color "#282a36"
:color "#e2e4e5")
(.source-content
:background-color "#282a36"
:color "#e2e4e5")
;; (".source-content td"
;; :background-color "#282a36"
;; :color "#e2e4e5")
(".source-content th"
:background-color "#43454f"
:color "#e2e4e5")
("#selection"
:background-color "#57c7ff"
:color "#34353e")
(.marked
:background-color "#5af78e"
:color "#34353e")
(.selected
:background-color "#57c7ff"
:color "#34353e")
(.button
:color "#e2e4e5")))))))
(in-package #:nyxt-user) ; While implicit, this allows SLY to know which package we are in.
;; (load "~/quicklisp/setup.lisp")
;; (ql:quickload :slynk)
;; (define-command-global start-slynk (&optional (slynk-port *swank-port*))
;; "Start a Slynk server that can be connected to, for instance, in
;; Emacs via SLY.
;; Warning: This allows Nyxt to be controlled remotely, that is, to execute
;; arbitrary code with the privileges of the user running Nyxt. Make sure
;; you understand the security risks associated with this before running
;; this command."
;; (slynk:create-server :port slynk-port :dont-close t)
;; (echo "Slynk server started at port ~a" slynk-port))
;; (start-slynk)

View file

@ -0,0 +1,20 @@
(in-package #:nyxt-user)
(define-configuration (buffer web-buffer)
((search-engines (list (engines:google :shortcut "gmaps"
:object :maps)
(engines:wordnet :shortcut "wn"
:show-word-frequencies t)
(engines:google :shortcut "g"
:safe-search nil)
(engines:duckduckgo :theme :terminal
:help-improve-duckduckgo nil
:homepage-privacy-tips nil
:privacy-newsletter nil
:newsletter-reminders nil
:install-reminders nil
:install-duckduckgo nil)
(engines:searx :base-search-url "https://search.tfcconnection.org/search?q=~a"
:request-method :get
:infinite-scroll t
:query-title t)))))

View file

@ -1,17 +0,0 @@
(in-package #:nyxt-user) ; While implicit, this allows SLY to know which package we are in.
(load "~/quicklisp/setup.lisp")
(ql:quickload :slynk)
(define-command-global start-slynk (&optional (slynk-port *swank-port*))
"Start a Slynk server that can be connected to, for instance, in
Emacs via SLY.
Warning: This allows Nyxt to be controlled remotely, that is, to execute
arbitrary code with the privileges of the user running Nyxt. Make sure
you understand the security risks associated with this before running
this command."
(slynk:create-server :port slynk-port :dont-close t)
(echo "Slynk server started at port ~a" slynk-port))
(start-slynk)

23
.config/nyxt/status.lisp Normal file
View file

@ -0,0 +1,23 @@
(in-package #:nyxt-user)
;;allow setting glyphs
(define-configuration status-buffer
((glyph-mode-presentation-p t)))
;; ;;various glyph settings with no additional configs
(define-configuration :force-https-mode ((glyph "ϕ")))
(define-configuration :blocker-mode ((glyph "β")))
(define-configuration :proxy-mode ((glyph "π")))
(define-configuration :reduce-tracking-mode ((glyph "∅")))
(define-configuration :certificate-exception-mode ((glyph "ɛ")))
(define-configuration :style-mode ((glyph "s")))
(define-configuration :user-script-mode ((glyph "ω")))
(define-configuration status-buffer
((style (str:concat %slot-value%
(theme:themed-css (theme *browser*)
;; See the `describe-class' of `status-buffer' to
;; understand what to customize
'("#controls"
:display "none"
:important))))))

73
.config/nyxt/style.lisp Normal file
View file

@ -0,0 +1,73 @@
(in-package #:nyxt-user) ; While implicit, this allows SLY to know which package we are in.
(setf (uiop:getenv "GTK_THEME") "Adwaita:dark")
(define-configuration browser
"Configuring my reddish theme."
((theme (make-instance
'theme:theme
:background-color "#282a36"
:on-background-color "#e2e4e5"
:accent-color "#5af78e"
:on-accent-color "#282a36"
:accent-alt-color "#9aedfe"
:on-accent-alt-color "#282a36"
:warning-color "#ff5c57"
:on-warning-color "#e2e4e5"
:primary-color "#43454f"
:on-primary-color "#57c7ff"
:on-secondary-color "#f3f99d"
:secondary-color "#282a36"
:font-family "VictorMono Nerd Font"))))
(define-configuration :dark-mode
"Dark-mode is a simple mode for simple HTML pages to color those in a darker palette.
I don't like the default gray-ish colors, though. Thus, I'm overriding
those to be a bit more laconia-like.
I'm not using this mode, though: I have nx-dark-reader."
((style
(theme:themed-css (theme *browser*)
`(*
:background-color ,(if (theme:dark-p theme:theme)
theme:background
theme:on-background)
"!important"
:background-image none "!important"
:color ,(if (theme:dark-p theme:theme)
theme:on-background
theme:background)
"!important")
`(a
:background-color ,(if (theme:dark-p theme:theme)
theme:background
theme:on-background)
"!important"
:background-image none "!important"
:color ,theme:primary "!important")))))
(define-configuration :hint-mode
((style
(theme:themed-css (theme *browser*)
`(".nyxt-hint" :background-color ,theme:accent :color
,theme:on-accent :font-family "monospace,monospace" :padding
"0px 0.3em" :border-color ,theme:primary :border-radius "0.4em"
:border-width "0.2em" :border-style "solid" :z-index 2147483647)
`(".nyxt-hint.nyxt-mark-hint" :background-color ,theme:secondary :color
,theme:on-secondary :font-weight "bold")
`(".nyxt-hint.nyxt-select-hint" :background-color ,theme:on-primary :color
,theme:primary)
`(".nyxt-hint.nyxt-match-hint" :padding "0px" :border-style "none" :opacity
"0.5")
`(".nyxt-element-hint" :background-color ,theme:on-primary)))))
;; (define-configuration :buffer
;; ((style
;; (theme:themed-css (theme *browser*)
;; `("h1,h2,h3,h4,h5,h6" :color ,theme:on-primary)
;; `(.button :background-color ,theme:primary
;; :color ,theme:on-primary
;; :border-radius "0.6em")
;; `(.link :color ,theme:on-primary)
;; `(a :color ,theme:on-primary))))

86
.config/nyxt/unpdf.lisp Normal file
View file

@ -0,0 +1,86 @@
(in-package #:nyxt-user)
;; I'm definining a new scheme to redirect PDF requests to. What it does is:
;; - Get the original file (if the URL is a filesystem path, simply use it).
;; - Save it to disk (if remote).
;; - Run pdftotext over the file.
;; - Display pdftotext output in a nice HTML page with interlinkable
;; page numbers and page contents as <pre> tags.
(define-internal-scheme "unpdf"
(lambda (url buffer)
(let* ((url (quri:uri url))
(original-url (quri:uri (quri:url-decode (quri:uri-path url))))
(local-p (or (null (quri:uri-scheme original-url))
(string= "file" (quri:uri-scheme original-url))))
(original-content (unless local-p
(dex:get (quri:render-uri original-url) :force-binary t))))
(flet ((display-pdf-contents (file)
(if (uiop:file-exists-p file)
(let ((pages (ignore-errors
(uiop:split-string
(uiop:run-program `("pdftotext" "-nodiag" ,(uiop:native-namestring file) "-")
:output '(:string :stripped t))
:separator '(#\Page)))))
(spinneret:with-html-string
(:head
(:style (style buffer))
;; A class to override the <pre> colors.
(:style (theme:themed-css (theme *browser*)
#+(or nyxt-2 nyxt-3-pre-release-1)
(.override
:background-color theme:background
:color theme:on-background
:font-size "150%"
:line-height "150%")
#+(and nyxt-3 (not (or nyxt-2 nyxt-3-pre-release-1)))
`(.override
:background-color ,theme:background
:color ,theme:on-background
:font-size "150%"
:line-height "150%"))))
(loop for page in pages
for number from 1
unless (uiop:emptyp page)
do (:section
:id (princ-to-string number)
(:h2.override (:a :href (format nil "#~d" number)
(princ-to-string number)))
(:pre.override (or page ""))))))
"")))
(if local-p
(display-pdf-contents (pathname (quri:uri-path original-url)))
(uiop:with-temporary-file (:pathname path :type "pdf" :keep t)
(log:debug "Temp file for ~a is ~a" url path)
(alexandria:write-byte-vector-into-file
(coerce original-content '(vector (unsigned-byte 8))) path :if-exists :supersede)
(display-pdf-contents path))))))
:local-p t)
(define-command-global unpdf-download-this ()
"A helper for unpdf: pages to download the original PDF to the regular destination.
Unpdf redirects all requests, even those that you need to read
elsewhere, thus I need this command."
(let* ((buffer (current-buffer))
(url (url buffer)))
(if (string= "unpdf" (quri:uri-scheme url))
(ffi-buffer-download buffer (quri:uri-path url))
;; I need to turn it into a mode someday...
(echo-warning "This command is for unpdf: pages only, it's useless elsewhere!"))))
(defun redirect-pdf (request-data)
(if (and (toplevel-p request-data)
(uiop:string-prefix-p "application/pdf" (mime-type request-data)))
;; I should somehow prompt about downloading instead...
(progn
(echo "Redirecting to the unpdf URL...")
(make-buffer-focus :url (quri:uri (str:concat "unpdf:" (render-url (url request-data)))))
;; Return nil to prevent Nyxt from downloading this PDF.
nil)
request-data))
(define-configuration :web-buffer
((request-resource-hook (hooks:add-hook %slot-value% 'redirect-pdf))))
(define-configuration nyxt/mode/file-manager:file-source
((supported-media-types `("pdf" ,@%slot-value%))))

File diff suppressed because it is too large Load diff

View file

@ -75,6 +75,9 @@
"imv"
"phinger-cursors-theme"
"firefox"
"icecat"
"qutebrowser"
"nyxt"
"openjdk"
"kwallet"
"kwallet-pam"
@ -119,6 +122,7 @@
"blesh"
"ncurses"
"transmission"
"sbcl"
;; Emacs and packages
"emacs-next-pgtk"
@ -176,6 +180,7 @@
"emacs-projectile"
"emacs-simple-httpd"
"emacs-direnv"
"emacs-sly"
"emacs-diredfl"
"emacs-pdf-tools"
"emacs-vterm"

37
guix/pkgs/zola.scm Normal file
View file

@ -0,0 +1,37 @@
(define-module (zola)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
#:use-module (gnu services)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system cargo)
#:use-module ((guix licenses) #:prefix license:))
(define-public zola
(let ((commit "8dd1b30594dcfa5344ba36b6b057a5b0aa9bd277")
(revision "0"))
(package
(name "zola")
(version "0.17.2")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/getzola/zola.git")
(commit commit)))
(sha256
(base32
"11ynfizxgfm0dy8i4s0dfws4g9chf12n41hzai8n936wxb3vb3r0"))))
(build-system cargo-build-system)
(native-inputs (list tar bzip2))
;; (arguments
;; )
(home-page "https://github.com/phisch/phinger-cursors")
(synopsis "Most likely the most over engineered cursor theme out there")
(description
"Say hello to your new cursor theme. Phinger cursors is most likely the most over engineered cursor theme out there.")
(license license:cc-by-sa4.0))))
zola

View file

@ -1,45 +1,37 @@
#!/bin/bash
#!/usr/bin/env bash
# Check to see if nyxt is running
if pgrep -x nyxt > /dev/null; then
echo running
if [ $(pgrep -c nyxt) -gt 0 ]; then
echo "ff running"
if [ $XDG_SESSION_TYPE = "x11" ]; then
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
#X11
nyxtrg=$(wmctrl -lx | rg nyxt | awk '{print $1}')
ffrg=$(wmctrl -lx | rg nyxt | awk '{print $1}')
# echo $emacsrg
if [ -z $nyxtrg ]; then
echo regnyxt
nyxt
if [ -z $ffrg ]; then
exec nyxt
exit
else
wmctrl -ia $nyxtrg
exec wmctrl -ia $ffrg
exit
fi
else
echo wayland
if [ $KDE_FULL_SESSION = "true" ]; then
ww -f nyxt -c nyxt
if [ "$KDE_FULL_SESSION" = "true" ]; then
echo "KDE"
exec /home/chris/bin/ww -fa nyxt -c nyxt
exit
else
# WAYLAND
nyxtrg=$(wlrctl window list | rg nyxt:)
ffrg=$(hyprctl clients | rg nyxt)
nyxtwin=$(echo $nyxtrg | sed 's/.*\: //')
# echo $nyxtwin
ffwin=$(echo $ffrg | sed 's/.*\: //')
# echo $ffwin
wlrctl toplevel focus nyxt
exec hyprctl dispatch focuswindow nyxt
exit
fi
fi
else
echo not running
machine=$(hostname)
if [ $machine = "syl" ]; then
# env GDK_DPI_SCALE=0.5 GDK_SCALE=2 nyxt
nyxt
else
nyxt
fi
exec nyxt
fi