nyxt being added

This commit is contained in:
Chris Cochrun 2021-05-24 20:47:05 -05:00
parent ae2ad7dd9d
commit f9228ee51d
8 changed files with 103 additions and 10 deletions

83
nyxt/init.lisp Normal file
View file

@ -0,0 +1,83 @@
(in-package :nyxt-user) ; While implicit, this allows SLY to know which package we are in.
(define-configuration (prompt-buffer)
((default-modes (append '(vi-insert-mode) %slot-default%))))
;; Create a function to launch mpv with given url
(defun mpv (url)
"MPV launches with given url"
(uiop:run-program (list "mpv" url)))
;; Let's create a function to hint videos 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)
(mpv (first nyxt/web-mode::result)))
:annotate-visible-only-p
nyxt/web-mode::annotate-visible-only-p))
(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)
(define-mode chris-mode ()
"Dummy mode for the custom key bindings in `*chris-keymap*'."
((keymap-scheme (keymap:make-scheme
scheme:vi-normal *chris-keymap*))))
(define-configuration buffer
((default-modes (append '(vi-normal-mode
auto-mode
reduce-tracking-mode
force-https-mode
chris-mode)
%slot-default%))))
(define-configuration status-buffer
((style
(str:concat
%slot-default%
(cl-css:css
'((body
:background "#282a36"
:color "#e2e4e5")))))))
(define-configuration internal-buffer
((style
(str:concat
%slot-default%
(cl-css:css
'((body
:background-color "#282a36"
:color "#e2e4e5")
(hr
:color "#5af78e")
(.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'
;; :background-color "#282a36")
;; (.button
;; :color "#e2e4e5")))))))
(load-after-system :slynk "~/.config/nyxt/my-slynk.lisp")

11
nyxt/my-slynk.lisp Normal file
View file

@ -0,0 +1,11 @@
(define-command 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))