summaryrefslogtreecommitdiff
path: root/.config/nyxt/statusline.lisp
diff options
context:
space:
mode:
authorThanosApollo <[email protected]>2022-11-02 05:08:30 +0200
committerThanosApollo <[email protected]>2022-11-02 05:08:30 +0200
commit4e21f4f8f9c0906d8aed468b495dcd448069e7af (patch)
tree033caacd8b6eb2236ff1d46e516b8fa16113770e /.config/nyxt/statusline.lisp
parentf843b572ed699b9f68a0ebe1480d688699b6a57d (diff)
Add dracula theming
Diffstat (limited to '.config/nyxt/statusline.lisp')
-rw-r--r--.config/nyxt/statusline.lisp73
1 files changed, 73 insertions, 0 deletions
diff --git a/.config/nyxt/statusline.lisp b/.config/nyxt/statusline.lisp
new file mode 100644
index 0000000..a90527e
--- /dev/null
+++ b/.config/nyxt/statusline.lisp
@@ -0,0 +1,73 @@
+;; (in-package #:nyxt-user)
+
+;; ;; Set StatusLines Mode Icons
+;; (define-configuration status-buffer ((glyph-mode-presentation-p t)))
+;; (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 "")))
+;; (define-configuration nyxt/help-mode:help-mode ((glyph "")))
+;; (define-configuration nyxt/web-mode:web-mode ((glyph "ω")))
+;; (define-configuration nyxt/auto-mode:auto-mode ((glyph "α")))
+
+;;Set StatusLines URL Icons
+(defun laconic-format-status-load-status (buffer)
+ (if (web-buffer-p buffer)
+ (case (slot-value buffer 'nyxt::load-status)
+ (:unloaded "∅")
+ (:loading "∞")
+ (:finished ""))
+ ""))
+
+;;Remove https/www from URL
+(defun laconic-format-status-url (buffer)
+ (markup:markup
+ (:span
+ (format nil "~a ~a"
+ (laconic-format-status-load-status buffer)
+ (ppcre:regex-replace-all
+ "(https://|www\\.|/$)"
+ (render-url (url buffer))
+ "")))))
+
+;;Set StatusLines Webpage Loadtime
+(defun laconic-format-status-modes (buffer window)
+ (str:concat
+ (format-status-modes buffer window)
+ " | "
+ (format nil "~d:~d"
+ (mod (+ 5 (local-time:timestamp-hour (local-time:now))) 24)
+ (local-time:timestamp-minute (local-time:now)))))
+
+;;Configure StatusLines Design
+(defun laconic-format-status (window)
+ (flet ((input-indicating-background ()
+ (format nil "background-color: ~:[#50fa7b~;#ff5555~]"
+ (or (current-mode 'vi-insert)
+ (current-mode 'input-edit)))))
+ (let ((buffer (current-buffer window)))
+ (markup:markup
+ (:div :id "container"
+ (:div :id "controls"
+ :style (input-indicating-background)
+ (markup:raw ""))
+ (:div :class "arrow arrow-right"
+ :style (input-indicating-background) "")
+ (:div :id "url"
+ (markup:raw
+ (laconic-format-status-url buffer)))
+ (:div :class "arrow arrow-right"
+ :style "background-color:#21222C" "")
+ (:div :id "tabs"
+ (title buffer))
+ (:div :class "arrow arrow-left"
+ :style "background-color:#21222C" "")
+ (:div :id "modes"
+ :title (nyxt::list-modes buffer)
+ (laconic-format-status-modes buffer window)))))))
+
+;;Define Current Configuration
+(define-configuration window
+ ((status-formatter #'laconic-format-status)))