Added video and comments

This commit is contained in:
Yann Esposito (Yogsototh) 2021-10-24 15:27:16 +02:00
parent 9c6a997cdb
commit 23039ebee9
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
2 changed files with 69 additions and 15 deletions

View file

@ -13,27 +13,35 @@ I think I made something worth to be shared.
I wanted to have the same effect than in iA writer within emacs. I wanted to have the same effect than in iA writer within emacs.
And I just reached this. And I just reached this.
So the effect I am looking to achieve can be seen in this gif. So the effect I am looking to achieve can be seen in this video.
TODO #+begin_export html
<video src="./zen-writer-demo.mov"
width="100%"
controls="true"
autoplay="true">
</video>
#+end_export
So mainly it highlight the current sentence (in black) while the rest of
the text is gray. It highlight the current sentence (in black) while the rest of the text is
gray.
The main issue with the =hl-sentence= package alone is that it set a specific The main issue with the =hl-sentence= package alone is that it set a specific
face to the current sentence, but does not affect the other text in the buffer. face to the current sentence, but does not affect the other text in the
In fact to make it work, you need to make the default color grey, and only buffer.
set black for the highlighted text. In fact to make it work as I would expect, you need to make the default
color grey, and only set black for the highlighted text.
But nice, I have recently created a personal theme close to that. Fortunately, I have recently created a personal theme close to that.
I created a new one. I just created a new specific one.
Everything is mostly "gray" except the font ~hl-sentence~ which is black. Everything is mostly "gray" except the font ~hl-sentence~ which is black.
And that's it. And that's it.
So to make it all work I need. So to make it all work I need.
- a Gray theme; - a Gray theme,
- the package ~hl-sentence~, - the package ~hl-sentence~,
- The ~writeroom~ package. - the ~writeroom~ package.
So how to achieve that yourself? So how to achieve that yourself?
Here is how I do it. Here is how I do it.
@ -43,10 +51,10 @@ Here is how I do it.
:CUSTOM_ID: the-zen-writer-theme :CUSTOM_ID: the-zen-writer-theme
:END: :END:
Download [[./doom-zen-writer-theme.el][Doom Zen-Writer theme]]. Download [[./doom-zen-writer-theme.el][Doom Zen-Writer theme]].
This depend on doom-themes and here is the code of the theme. This depend on doom-themes and here is the code of the theme.
Just put it in you =~/.doom.d/themes= directory Just put it in you =~/.doom.d/themes= directory.
** add this is your ~packages.el~ ** add this is your ~packages.el~
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: add-this-is-your--packages-el- :CUSTOM_ID: add-this-is-your--packages-el-
@ -67,13 +75,59 @@ Here is a [[file:zen-writer.el][zen-writer.el]] file that contain my keymaps and
Put it in you =~/.doom.d/= directory and in you =config.el= Put it in you =~/.doom.d/= directory and in you =config.el=
put put
#+begin_src elisp #+begin_src emacs-lisp
(load! "~/.doom.d/zen-writer.el") (load! "~/.doom.d/zen-writer.el")
#+end_src #+end_src
And with this you should pass to zen mode with ~SPC y z z~. And with this you should pass to zen mode with ~SPC y z z~.
To make the un-zen works.
You will need to have a ~y/auto-update-theme~ function that set your current theme.
My function change the theme depending on the time of the day or the day of
the week.
So here it is for inspiration:
#+begin_src emacs-lisp
(defun y/auto-update-theme ()
"depending on time use different theme"
;; very early => gruvbox-light, solarized-light, nord-light
(let* ((day-of-week (format-time-string "%a"))
(week-end? (or (equal "Sat" day-of-week)
(equal "Sun" day-of-week)))
(hour (nth 2 (decode-time (current-time))))
(time-to-sleep? (or (> hour 22) (< hour 7)))
(theme (cond
(time-to-sleep? 'doom-plain-dark)
(week-end? 'doom-nord-light)
((<= 7 hour 8) 'doom-gruvbox-light)
((= 9 hour) 'doom-solarized-light)
((<= 10 hour 16) 'doom-solarized-white)
((<= 17 hour 18) 'doom-gruvbox-light)
((<= 19 hour 22) 'doom-oceanic-next))))
(when (not (equal doom-theme theme))
(setq doom-theme theme)
(load-theme doom-theme t))
;; run that function again next hour
(run-at-time (format "%02d:%02d" (+ hour 1) 0) nil 'y/auto-update-theme)))
#+end_src
** Bonus
:PROPERTIES:
:CUSTOM_ID: bonus
:END:
I use Nerd Fonts and in particular the font `iMWritingDuoS` which is I
think a clone of the iAWriter font.
#+begin_src emacs-lisp
(setq doom-variable-pitch-font
(font-spec :family "iMWritingDuoS Nerd Font" :size 12))
#+end_src
I hope you find this useful. I hope you find this useful.
I really like how it looks now.
** Annex ** Annex
:PROPERTIES: :PROPERTIES:
@ -281,5 +335,5 @@ Can be an integer to determine the exact padding."
:background modeline-bg-inactive-alt :background modeline-bg-inactive-alt
:box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-inactive-alt))))) :box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-inactive-alt)))))
;;; doom-plain-theme.el ends here ;;; doom-zen-writer-theme.el ends here
#+end_src #+end_src