Improve `eww` appearance for Emacs

This commit is contained in:
Alex Palaistras 2022-06-20 19:53:03 +01:00
parent 4ff985fe11
commit ea08c7177c
3 changed files with 23 additions and 9 deletions

View File

@ -20,11 +20,10 @@
doom-theme 'doom-monokai-pro
;; Font definitions.
doom-font (font-spec :family "Iosevka" :size 24 :weight 'light)
doom-big-font (font-spec :family "Iosevka" :size 28 :weight 'light)
doom-variable-pitch-font (font-spec :family "IBM Plex Sans" :size 22 :weight 'light)
doom-serif-font (font-spec :family "IBM Plex Serif" :size 22 :weight 'light)
doom-unicode-font (font-spec :family "Iosevka" :size 24 :weight 'light)
doom-font (font-spec :family "Iosevka" :size 24 :weight 'light)
doom-big-font (font-spec :family "Iosevka" :size 28 :weight 'light)
doom-variable-pitch-font (font-spec :family "IBM Plex Sans" :size 22 :weight 'light)
doom-unicode-font (font-spec :family "Iosevka" :size 24 :weight 'light)
;; Column used as limit for various modes.
fill-column 100
@ -89,9 +88,12 @@
(set-popup-rule! "^\\*eshell\\*" :vslot -5 :size 0.35 :select t :modeline nil :quit nil :ttl nil))
(after! eww
(setq shr-use-fonts nil
shr-discard-aria-hidden t)
(set-popup-rule! "^\\*eww\\*" :side 'right :select t :quit 'nil :slot 0 :width 0.5))
(setq shr-use-fonts t
shr-discard-aria-hidden t
shr-max-width fill-column
eww-search-prefix "https://lite.duckduckgo.com/lite?q=")
(defun shr-add-font (start end type) (+custom/shr-add-font start end type))
(set-popup-rule! "^\\*eww\\*" :side 'right :select t :quit 'nil :slot 0 :width (+ fill-column 4)))
(after! (json-mode evil)
(evil-define-key 'normal json-mode-map (kbd "<tab>") 'evil-toggle-fold))

View File

@ -71,3 +71,15 @@ to the `killed-buffer-list' when killing the buffer."
current-prefix-arg))
(doom/copy-this-file new-path force-p)
(find-file new-path))
;;;###autoload
(defun +custom/shr-add-font (start end type)
(save-excursion
(goto-char start)
(while (< (point) end)
(when (bolp)
(skip-chars-forward " "))
(add-face-text-property (point) (min (line-end-position) end) type)
(if (< (line-end-position) end)
(forward-line 1)
(goto-char end)))))

View File

@ -17,7 +17,7 @@
nav-flash
ophints
(popup +all +defaults)
treemacs
(treemacs +lsp)
vc-gutter
(window-select +numbers +switch-window)
workspaces