Skip to content

Commit d23e797

Browse files
committed
Initial commit.
0 parents  commit d23e797

File tree

5 files changed

+175
-0
lines changed

5 files changed

+175
-0
lines changed

COPYING

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2020, Artyom Bologov <[email protected]>
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.org

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#+TITLE:My Nyxt Configuration Files
2+
3+
This is my repo with small tweaks to Nyxt that make it more
4+
comfortable and personal. Things of interest here:
5+
6+
* Alternative format for status-buffer
7+
8+
I don't like the default wordy version of status-buffer (especially
9+
with long mode names), so I define my own =short-format-status= to make
10+
modeline a bit more minimalistic. Several helper functions
11+
(=format-short-status-*=) are there to make things easier.
12+
13+
This can evolve into an extension someday.
14+
15+
* Status-buffer tweaking for big screens
16+
17+
Small change in =status-buffer= CSS to make it more readable on a big
18+
screen. It's commented for now, but I'll uncomment it once I fully
19+
migrate to a big-screen PC.

init.lisp

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
(in-package #:nyxt-user)
2+
3+
(load-after-system :slynk (nyxt-init-file "slynk.lisp"))
4+
5+
(define-configuration browser
6+
((session-restore-prompt :always-ask)))
7+
8+
(defun format-short-status-modes (&optional (buffer (current-buffer)))
9+
(str:replace-using
10+
'("-mode" ""
11+
"base" ""
12+
"emacs" "ξ" ; Xi looks like Emacs logo...
13+
"force-https" "ϕ"
14+
"auto" "α"
15+
"blocker" "β"
16+
"proxy" "π"
17+
"reduce-tracking" "τ"
18+
"certificate-exception" "χ"
19+
"style" "σ"
20+
"web" "ω"
21+
"help" "?")
22+
(format nil "~{~a~^ ~}"
23+
(mapcar (alexandria:compose #'str:downcase #'mode-name)
24+
(modes buffer)))))
25+
26+
(defun format-short-status-load-status (&optional (buffer (current-buffer)))
27+
(when (web-buffer-p buffer)
28+
(case (slot-value buffer 'nyxt::load-status)
29+
(:unloaded "")
30+
(:loading "")
31+
(:finished ""))))
32+
33+
(defun format-short-status-url (&optional (buffer (current-buffer)))
34+
(markup:markup
35+
(:a :class "button"
36+
:href (lisp-url '(nyxt:set-url-from-current-url))
37+
(str:concat
38+
(format-short-status-load-status buffer)
39+
(format nil " ~a~a"
40+
(ppcre:regex-replace-all
41+
"(https://|www\\.|/$)"
42+
(object-display (url buffer))
43+
"")
44+
(title buffer))))))
45+
46+
(defun short-format-status (window)
47+
(let ((buffer (current-buffer window)))
48+
(markup:markup
49+
(:div :id "container"
50+
(:div :id "controls" (markup:raw ""))
51+
(:div :class "arrow arrow-right"
52+
:style "background-color:rgb(80,80,80)" "")
53+
(:div :id "url" (markup:raw (format-short-status-url buffer)))
54+
(:div :class "arrow arrow-right"
55+
:style "background-color:rgb(120,120,120)" "")
56+
(:div :id "tabs" (markup:raw (format-status-tabs)))
57+
(:div :class "arrow arrow-left"
58+
:style "background-color:rgb(120,120,120)" "")
59+
(:div :id "modes" (format-short-status-modes buffer))))))
60+
61+
(define-configuration window
62+
((status-formatter #'short-format-status)
63+
(message-buffer-style
64+
(str:concat
65+
%slot-default
66+
(cl-css:css
67+
'((body
68+
:background-color "black"
69+
:color "white")))))))
70+
71+
;; ;; An experimental setting for transition to a bigger screen.
72+
;; (define-configuration status-buffer
73+
;; ((height 30)
74+
;; (style (str:concat %slot-default
75+
;; (cl-css:css
76+
;; '((body
77+
;; :font-size "20px"
78+
;; :line-height "30px")
79+
;; (".arrow"
80+
;; :height "30px")))))))
81+
82+
(define-configuration minibuffer
83+
((style
84+
(str:concat
85+
%slot-default
86+
(cl-css:css
87+
'((body
88+
:background-color "black"
89+
:color "#808080")))))))
90+
91+
(define-configuration buffer
92+
((default-modes `(emacs-mode ,@%slot-default))
93+
(conservative-word-move t)
94+
;; QWERTY home row.
95+
(hints-alphabet "DSJKHLFAGNMXCWEIO")))
96+
97+
(define-configuration web-buffer
98+
((default-modes `(emacs-mode auto-mode blocker-mode force-https-mode
99+
,@%slot-default))))
100+
101+
(define-configuration internal-buffer
102+
((style
103+
(str:concat
104+
%slot-default
105+
(cl-css:css
106+
'((body
107+
:background-color "black"
108+
:color "lightgray")
109+
(hr
110+
:color "darkgray")
111+
(.button
112+
:color "#333333")))))))
113+
114+
(define-configuration nyxt/auto-mode:auto-mode
115+
((nyxt/auto-mode:prompt-on-mode-toggle t)))

install.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
ln -sf . ~/.config/nyxt

slynk.lisp

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(define-command start-slynk (&optional (slynk-port *swank-port*))
2+
"Start a Slynk server that can be connected to, for instance, in
3+
Emacs via SLY.
4+
Warning: This allows Next to be controlled remotely, that is, to
5+
execute arbitrary code with the privileges of the user running Next.
6+
Make sure you understand the security risks associated with this
7+
before running this command."
8+
(slynk:create-server :port slynk-port :dont-close t)
9+
(echo "Slynk server started at port ~a" slynk-port))
10+
11+
;; Start slynk by default.
12+
(unless nyxt::*keep-alive*
13+
(slynk:create-server :port 4006 :dont-close t))

0 commit comments

Comments
 (0)